-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.php
128 lines (82 loc) · 2.23 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
require_once('color.php');
echo "<pre>";
/*
$color = "#666666";
box($color);
$unpack = _color_unpack($color,true);
$hsl = _color_rgb2hsl($unpack);
var_dump($hsl);
$hsl[0] += .3333;
var_dump($hsl);
$new_rgb = _color_hsl2rgb($hsl);
$new_color = _color_pack($new_rgb,true);
box($new_color);
$unpack = _color_unpack($new_color,true);
$hsl = _color_rgb2hsl($unpack);
var_dump($hsl);
$hsl[0] += .33333;
var_dump($hsl);
$new_rgb = _color_hsl2rgb($hsl);
$new_color = _color_pack($new_rgb,true);
box($new_color);
*/
$color = "#FF8000";
box($color);
$unpack = _color_unpack($color, true);
$hsl = _color_rgb2hsl($unpack);
//var_dump($hsl);
$hsl[1] -= .3333;
//var_dump($hsl);
$new_rgb = _color_hsl2rgb($hsl);
$new_color = _color_pack($new_rgb, true);
box($new_color);
$unpack = _color_unpack($new_color, true);
$hsl = _color_rgb2hsl($unpack);
//var_dump($hsl);
$hsl[1] -= .33333;
//var_dump($hsl);
$new_rgb = _color_hsl2rgb($hsl);
$new_color = _color_pack($new_rgb, true);
box($new_color);
$unpack = _color_unpack($new_color, true);
$hsl = _color_rgb2hsl($unpack);
//var_dump($hsl);
$hsl[1] -= .33333;
//var_dump($hsl);
$new_rgb = _color_hsl2rgb($hsl);
$new_color = _color_pack($new_rgb, true);
box($new_color);
$unpack = _color_unpack($new_color, true);
$hsl = _color_rgb2hsl($unpack);
//var_dump($hsl);
$hsl[1] -= .33333;
//var_dump($hsl);
$new_rgb = _color_hsl2rgb($hsl);
$new_color = _color_pack($new_rgb, true);
box($new_color);
$unpack = _color_unpack($new_color, true);
$hsl = _color_rgb2hsl($unpack);
//var_dump($hsl);
$hsl[1] += .33333;
//var_dump($hsl);
$new_rgb = _color_hsl2rgb($hsl);
$new_color = _color_pack($new_rgb, true);
box($new_color);
$testrgb = array(0.2,0.75,0.4); //RGB to start with
print_r($testrgb);
print "Hex: ";
$testhex = "#C5003E";
print $testhex;
$testhex2rgb = _color_unpack($testhex, true);
print "<br />RGB: ";
var_dump($testhex2rgb);
print "<br />HSL color module: ";
$testrgb2hsl = _color_rgb2hsl($testhex2rgb); //Converteren naar HSL
var_dump($testrgb2hsl);
print "<br />RGB: ";
$testhsl2rgb = _color_hsl2rgb($testrgb2hsl); // En weer terug naar RGB
var_dump($testhsl2rgb);
print "<br />Hex: ";
$testrgb2hex = _color_pack($testhsl2rgb, true);
var_dump($testrgb2hex);