Rev 142 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 142 | Rev 143 | ||
---|---|---|---|
Line 100... | Line 100... | ||
100 | $color .= (strlen($b) < 2 ? '0' : '').$b; |
100 | $color .= (strlen($b) < 2 ? '0' : '').$b; |
101 | return '#'.$color; |
101 | return '#'.$color; |
102 | } |
102 | } |
103 | 103 | ||
104 | function changeHueOfCSS($css_content, $h_shift=0, $s_shift=0, $v_shift=0) { |
104 | function changeHueOfCSS($css_content, $h_shift=0, $s_shift=0, $v_shift=0) { |
- | 105 | // TODO: also support rgb() and rgba() color references (and maybe also hsl?) |
|
105 | $css_content = preg_replace_callback('@#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})@ismU', |
106 | $css_content = preg_replace_callback('@#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})@ismU', |
106 | function ($x) use ($h_shift, $s_shift, $v_shift) { |
107 | function ($x) use ($h_shift, $s_shift, $v_shift) { |
107 | if (strlen($x[1]) == 3) { |
108 | if (strlen($x[1]) == 3) { |
108 | $r = hexdec($x[1][0].$x[1][0]); |
109 | $r = hexdec($x[1][0].$x[1][0]); |
109 | $g = hexdec($x[1][1].$x[1][1]); |
110 | $g = hexdec($x[1][1].$x[1][1]); |