Jetpack_Color

Color utility and conversion.

Defined (1)

The class is defined in the following location(s).

/_inc/lib/class.color.php  
  1. class Jetpack_Color { 
  2. /** 
  3. * @var int 
  4. */ 
  5. protected $color = 0; 
  6.  
  7. /** 
  8. * Initialize object 
  9. * @param string|array $color A color of the type $type 
  10. * @param string $type The type of color we will construct from. 
  11. * One of hex (default), rgb, hsl, int 
  12. */ 
  13. public function __construct( $color = null, $type = 'hex' ) { 
  14. if ( $color ) { 
  15. switch ( $type ) { 
  16. case 'hex': 
  17. $this->fromHex( $color ); 
  18. break; 
  19. case 'rgb': 
  20. if ( is_array( $color ) && count( $color ) == 3 ) { 
  21. list( $r, $g, $b ) = array_values( $color ); 
  22. $this->fromRgbInt( $r, $g, $b ); 
  23. break; 
  24. case 'hsl': 
  25. if ( is_array( $color ) && count( $color ) == 3 ) { 
  26. list( $h, $s, $l ) = array_values( $color ); 
  27. $this->fromHsl( $h, $s, $l ); 
  28. break; 
  29. case 'int': 
  30. $this->fromInt( $color ); 
  31. break; 
  32. default: 
  33. // there is no default. 
  34. break; 
  35.  
  36. /** 
  37. * Init color from hex value 
  38. * @param string $hexValue 
  39. * @return Jetpack_Color 
  40. */ 
  41. public function fromHex($hexValue) { 
  42. $hexValue = str_replace( '#', '', $hexValue ); 
  43. // handle short hex codes like #fff 
  44. if ( 3 === strlen( $hexValue ) ) { 
  45. $short = $hexValue; 
  46. $i = 0; 
  47. $hexValue = ''; 
  48. while ( $i < 3 ) { 
  49. $chunk = substr($short, $i, 1 ); 
  50. $hexValue .= $chunk . $chunk; 
  51. $i++; 
  52. $intValue = hexdec( $hexValue ); 
  53.  
  54. if ( $intValue < 0 || $intValue > 16777215 ) { 
  55. throw new RangeException( $hexValue . " out of valid color code range" ); 
  56.  
  57. $this->color = $intValue; 
  58.  
  59. return $this; 
  60.  
  61. /** 
  62. * Init color from integer RGB values 
  63. * @param int $red 
  64. * @param int $green 
  65. * @param int $blue 
  66. * @return Jetpack_Color 
  67. */ 
  68. public function fromRgbInt($red, $green, $blue) 
  69. if ( $red < 0 || $red > 255 ) 
  70. throw new RangeException( "Red value " . $red . " out of valid color code range" ); 
  71.  
  72. if ( $green < 0 || $green > 255 ) 
  73. throw new RangeException( "Green value " . $green . " out of valid color code range" ); 
  74.  
  75. if ( $blue < 0 || $blue > 255 ) 
  76. throw new RangeException( "Blue value " . $blue . " out of valid color code range" ); 
  77.  
  78. $this->color = (int)(($red << 16) + ($green << 8) + $blue); 
  79.  
  80. return $this; 
  81.  
  82. /** 
  83. * Init color from hex RGB values 
  84. * @param string $red 
  85. * @param string $green 
  86. * @param string $blue 
  87. * @return Jetpack_Color 
  88. */ 
  89. public function fromRgbHex($red, $green, $blue) 
  90. return $this->fromRgbInt(hexdec($red), hexdec($green), hexdec($blue)); 
  91.  
  92. /** 
  93. * Converts an HSL color value to RGB. Conversion formula 
  94. * adapted from http://en.wikipedia.org/wiki/HSL_color_space. 
  95. * @param int $h Hue. [0-360] 
  96. * @param in $s Saturation [0, 100] 
  97. * @param int $l Lightness [0, 100] 
  98. */ 
  99. public function fromHsl( $h, $s, $l ) { 
  100. $h /= 360; $s /= 100; $l /= 100; 
  101.  
  102. if ( $s == 0 ) { 
  103. $r = $g = $b = $l; // achromatic 
  104. else { 
  105. $q = $l < 0.5 ? $l * ( 1 + $s ) : $l + $s - $l * $s; 
  106. $p = 2 * $l - $q; 
  107. $r = $this->hue2rgb( $p, $q, $h + 1/3 ); 
  108. $g = $this->hue2rgb( $p, $q, $h ); 
  109. $b = $this->hue2rgb( $p, $q, $h - 1/3 ); 
  110.  
  111. return $this->fromRgbInt( $r * 255, $g * 255, $b * 255 ); 
  112.  
  113. /** 
  114. * Helper function for Jetpack_Color::fromHsl() 
  115. */ 
  116. private function hue2rgb( $p, $q, $t ) { 
  117. if ( $t < 0 ) $t += 1; 
  118. if ( $t > 1 ) $t -= 1; 
  119. if ( $t < 1/6 ) return $p + ( $q - $p ) * 6 * $t; 
  120. if ( $t < 1/2 ) return $q; 
  121. if ( $t < 2/3 ) return $p + ( $q - $p ) * ( 2/3 - $t ) * 6; 
  122. return $p; 
  123.  
  124. /** 
  125. * Init color from integer value 
  126. * @param int $intValue 
  127. * @return Jetpack_Color 
  128. */ 
  129. public function fromInt($intValue) 
  130. if ( $intValue < 0 || $intValue > 16777215 ) 
  131. throw new RangeException( $intValue . " out of valid color code range" ); 
  132.  
  133. $this->color = $intValue; 
  134.  
  135. return $this; 
  136.  
  137. /** 
  138. * Convert color to hex 
  139. * @return string 
  140. */ 
  141. public function toHex() 
  142. return str_pad(dechex($this->color), 6, '0', STR_PAD_LEFT); 
  143.  
  144. /** 
  145. * Convert color to RGB array (integer values) 
  146. * @return array 
  147. */ 
  148. public function toRgbInt() 
  149. return array( 
  150. 'red' => (int)(255 & ($this->color >> 16)),  
  151. 'green' => (int)(255 & ($this->color >> 8)),  
  152. 'blue' => (int)(255 & ($this->color)) 
  153. ); 
  154.  
  155. /** 
  156. * Convert color to RGB array (hex values) 
  157. * @return array 
  158. */ 
  159. public function toRgbHex() 
  160. $r = array(); 
  161. foreach ($this->toRgbInt() as $item) { 
  162. $r[] = dechex($item); 
  163. return $r; 
  164.  
  165. /** 
  166. * Get Hue/Saturation/Value for the current color 
  167. * (float values, slow but accurate) 
  168. * @return array 
  169. */ 
  170. public function toHsvFloat() 
  171. $rgb = $this->toRgbInt(); 
  172.  
  173. $rgbMin = min($rgb); 
  174. $rgbMax = max($rgb); 
  175.  
  176. $hsv = array( 
  177. 'hue' => 0,  
  178. 'sat' => 0,  
  179. 'val' => $rgbMax 
  180. ); 
  181.  
  182. // If v is 0, color is black 
  183. if ($hsv['val'] == 0) { 
  184. return $hsv; 
  185.  
  186. // Normalize RGB values to 1 
  187. $rgb['red'] /= $hsv['val']; 
  188. $rgb['green'] /= $hsv['val']; 
  189. $rgb['blue'] /= $hsv['val']; 
  190. $rgbMin = min($rgb); 
  191. $rgbMax = max($rgb); 
  192.  
  193. // Calculate saturation 
  194. $hsv['sat'] = $rgbMax - $rgbMin; 
  195. if ($hsv['sat'] == 0) { 
  196. $hsv['hue'] = 0; 
  197. return $hsv; 
  198.  
  199. // Normalize saturation to 1 
  200. $rgb['red'] = ($rgb['red'] - $rgbMin) / ($rgbMax - $rgbMin); 
  201. $rgb['green'] = ($rgb['green'] - $rgbMin) / ($rgbMax - $rgbMin); 
  202. $rgb['blue'] = ($rgb['blue'] - $rgbMin) / ($rgbMax - $rgbMin); 
  203. $rgbMin = min($rgb); 
  204. $rgbMax = max($rgb); 
  205.  
  206. // Calculate hue 
  207. if ($rgbMax == $rgb['red']) { 
  208. $hsv['hue'] = 0.0 + 60 * ($rgb['green'] - $rgb['blue']); 
  209. if ($hsv['hue'] < 0) { 
  210. $hsv['hue'] += 360; 
  211. } else if ($rgbMax == $rgb['green']) { 
  212. $hsv['hue'] = 120 + (60 * ($rgb['blue'] - $rgb['red'])); 
  213. } else { 
  214. $hsv['hue'] = 240 + (60 * ($rgb['red'] - $rgb['green'])); 
  215.  
  216. return $hsv; 
  217.  
  218. /** 
  219. * Get HSV values for color 
  220. * (integer values from 0-255, fast but less accurate) 
  221. * @return int 
  222. */ 
  223. public function toHsvInt() 
  224. $rgb = $this->toRgbInt(); 
  225.  
  226. $rgbMin = min($rgb); 
  227. $rgbMax = max($rgb); 
  228.  
  229. $hsv = array( 
  230. 'hue' => 0,  
  231. 'sat' => 0,  
  232. 'val' => $rgbMax 
  233. ); 
  234.  
  235. // If value is 0, color is black 
  236. if ($hsv['val'] == 0) { 
  237. return $hsv; 
  238.  
  239. // Calculate saturation 
  240. $hsv['sat'] = round(255 * ($rgbMax - $rgbMin) / $hsv['val']); 
  241. if ($hsv['sat'] == 0) { 
  242. $hsv['hue'] = 0; 
  243. return $hsv; 
  244.  
  245. // Calculate hue 
  246. if ($rgbMax == $rgb['red']) { 
  247. $hsv['hue'] = round(0 + 43 * ($rgb['green'] - $rgb['blue']) / ($rgbMax - $rgbMin)); 
  248. } else if ($rgbMax == $rgb['green']) { 
  249. $hsv['hue'] = round(85 + 43 * ($rgb['blue'] - $rgb['red']) / ($rgbMax - $rgbMin)); 
  250. } else { 
  251. $hsv['hue'] = round(171 + 43 * ($rgb['red'] - $rgb['green']) / ($rgbMax - $rgbMin)); 
  252. if ($hsv['hue'] < 0) { 
  253. $hsv['hue'] += 255; 
  254.  
  255. return $hsv; 
  256.  
  257. /** 
  258. * Converts an RGB color value to HSL. Conversion formula 
  259. * adapted from http://en.wikipedia.org/wiki/HSL_color_space. 
  260. * Assumes r, g, and b are contained in the set [0, 255] and 
  261. * returns h in [0, 360], s in [0, 100], l in [0, 100] 
  262. * @return Array The HSL representation 
  263. */ 
  264. public function toHsl() { 
  265. list( $r, $g, $b ) = array_values( $this->toRgbInt() ); 
  266. $r /= 255; $g /= 255; $b /= 255; 
  267. $max = max( $r, $g, $b ); 
  268. $min = min( $r, $g, $b ); 
  269. $h = $s = $l = ( $max + $min ) / 2; 
  270. #var_dump( array( compact('max', 'min', 'r', 'g', 'b')) ); 
  271. if ( $max == $min ) { 
  272. $h = $s = 0; // achromatic 
  273. else { 
  274. $d = $max - $min; 
  275. $s = $l > 0.5 ? $d / ( 2 - $max - $min ) : $d / ( $max + $min ); 
  276. switch ( $max ) { 
  277. case $r: 
  278. $h = ( $g - $b ) / $d + ( $g < $b ? 6 : 0 ); 
  279. break; 
  280. case $g: 
  281. $h = ( $b - $r ) / $d + 2; 
  282. break; 
  283. case $b: 
  284. $h = ( $r - $g ) / $d + 4; 
  285. break; 
  286. $h /= 6; 
  287. $h = (int) round( $h * 360 ); 
  288. $s = (int) round( $s * 100 ); 
  289. $l = (int) round( $l * 100 ); 
  290. return compact( 'h', 's', 'l' ); 
  291.  
  292. public function toCSS( $type = 'hex', $alpha = 1 ) { 
  293. switch ( $type ) { 
  294. case 'hex': 
  295. return $this->toString(); 
  296. break; 
  297. case 'rgb': 
  298. case 'rgba': 
  299. list( $r, $g, $b ) = array_values( $this->toRgbInt() ); 
  300. if ( is_numeric( $alpha ) && $alpha < 1 ) { 
  301. return "rgba( {$r}, {$g}, {$b}, $alpha )"; 
  302. else { 
  303. return "rgb( {$r}, {$g}, {$b} )"; 
  304. break; 
  305. case 'hsl': 
  306. case 'hsla': 
  307. list( $h, $s, $l ) = array_values( $this->toHsl() ); 
  308. if ( is_numeric( $alpha ) && $alpha < 1 ) { 
  309. return "hsla( {$h}, {$s}, {$l}, $alpha )"; 
  310. else { 
  311. return "hsl( {$h}, {$s}, {$l} )"; 
  312. break; 
  313. default: 
  314. return $this->toString(); 
  315. break; 
  316.  
  317. /** 
  318. * Get current color in XYZ format 
  319. * @return array 
  320. */ 
  321. public function toXyz() 
  322. $rgb = $this->toRgbInt(); 
  323.  
  324. // Normalize RGB values to 1 
  325.  
  326. $rgb_new = array(); 
  327. foreach ($rgb as $item) { 
  328. $rgb_new[] = $item / 255; 
  329. $rgb = $rgb_new; 
  330.  
  331. $rgb_new = array(); 
  332. foreach ($rgb as $item) { 
  333. if ($item > 0.04045) { 
  334. $item = pow((($item + 0.055) / 1.055), 2.4); 
  335. } else { 
  336. $item = $item / 12.92; 
  337. $rgb_new[] = $item * 100; 
  338. $rgb = $rgb_new; 
  339.  
  340. //Observer. = 2, Illuminant = D65 
  341. $xyz = array( 
  342. 'x' => ($rgb['red'] * 0.4124) + ($rgb['green'] * 0.3576) + ($rgb['blue'] * 0.1805),  
  343. 'y' => ($rgb['red'] * 0.2126) + ($rgb['green'] * 0.7152) + ($rgb['blue'] * 0.0722),  
  344. 'z' => ($rgb['red'] * 0.0193) + ($rgb['green'] * 0.1192) + ($rgb['blue'] * 0.9505) 
  345. ); 
  346.  
  347. return $xyz; 
  348.  
  349. /** 
  350. * Get color CIE-Lab values 
  351. * @return array 
  352. */ 
  353. public function toLabCie() 
  354. $xyz = $this->toXyz(); 
  355.  
  356. //Ovserver = 2*, Iluminant=D65 
  357. $xyz['x'] /= 95.047; 
  358. $xyz['y'] /= 100; 
  359. $xyz['z'] /= 108.883; 
  360.  
  361. $xyz_new = array(); 
  362. foreach ($xyz as $item) { 
  363. if ($item > 0.008856) { 
  364. $xyz_new[] = pow($item, 1/3); 
  365. } else { 
  366. $xyz_new[] = (7.787 * $item) + (16 / 116); 
  367. $xyz = $xyz_new; 
  368.  
  369. $lab = array( 
  370. 'l' => (116 * $xyz['y']) - 16,  
  371. 'a' => 500 * ($xyz['x'] - $xyz['y']),  
  372. 'b' => 200 * ($xyz['y'] - $xyz['z']) 
  373. ); 
  374.  
  375. return $lab; 
  376.  
  377. /** 
  378. * Convert color to integer 
  379. * @return int 
  380. */ 
  381. public function toInt() 
  382. return $this->color; 
  383.  
  384. /** 
  385. * Alias of toString() 
  386. * @return string 
  387. */ 
  388. public function __toString() 
  389. return $this->toString(); 
  390.  
  391. /** 
  392. * Get color as string 
  393. * @return string 
  394. */ 
  395. public function toString() 
  396. $str = $this->toHex(); 
  397. return strtoupper("#{$str}"); 
  398.  
  399. /** 
  400. * Get the distance between this color and the given color 
  401. * @param Jetpack_Color $color 
  402. * @return int 
  403. */ 
  404. public function getDistanceRgbFrom(Jetpack_Color $color) 
  405. $rgb1 = $this->toRgbInt(); 
  406. $rgb2 = $color->toRgbInt(); 
  407.  
  408. $rDiff = abs($rgb1['red'] - $rgb2['red']); 
  409. $gDiff = abs($rgb1['green'] - $rgb2['green']); 
  410. $bDiff = abs($rgb1['blue'] - $rgb2['blue']); 
  411.  
  412. // Sum of RGB differences 
  413. $diff = $rDiff + $gDiff + $bDiff; 
  414. return $diff; 
  415.  
  416. /** 
  417. * Get distance from the given color using the Delta E method 
  418. * @param Jetpack_Color $color 
  419. * @return float 
  420. */ 
  421. public function getDistanceLabFrom(Jetpack_Color $color) 
  422. $lab1 = $this->toLabCie(); 
  423. $lab2 = $color->toLabCie(); 
  424.  
  425. $lDiff = abs($lab2['l'] - $lab1['l']); 
  426. $aDiff = abs($lab2['a'] - $lab1['a']); 
  427. $bDiff = abs($lab2['b'] - $lab1['b']); 
  428.  
  429. $delta = sqrt($lDiff + $aDiff + $bDiff); 
  430.  
  431. return $delta; 
  432.  
  433. public function toLuminosity() { 
  434. extract( $this->toRgbInt() ); 
  435. return 0.2126 * pow( $red / 255, 2.2 ) + 0.7152 * pow( $green / 255, 2.2 ) + 0.0722 * pow( $blue / 255, 2.2); 
  436.  
  437. /** 
  438. * Get distance between colors using luminance. 
  439. * Should be more than 5 for readable contrast 
  440. * @param Jetpack_Color $color Another color 
  441. * @return float 
  442. */ 
  443. public function getDistanceLuminosityFrom(Jetpack_Color $color) { 
  444. $L1 = $this->toLuminosity(); 
  445. $L2 = $color->toLuminosity(); 
  446. if ( $L1 > $L2 ) { 
  447. return ( $L1 + 0.05 ) / ( $L2 + 0.05 ); 
  448. else{ 
  449. return ( $L2 + 0.05 ) / ( $L1 + 0.05 ); 
  450.  
  451. public function getMaxContrastColor() { 
  452. $lum = $this->toLuminosity(); 
  453. $color = new Jetpack_Color; 
  454. $hex = ( $lum >= 0.5 ) ? '000000' : 'ffffff'; 
  455. return $color->fromHex( $hex ); 
  456.  
  457. public function getGrayscaleContrastingColor( $contrast = false ) { 
  458. if ( ! $contrast ) { 
  459. return $this->getMaxContrastColor(); 
  460. // don't allow less than 5 
  461. $target_contrast = ( $contrast < 5 ) ? 5 : $contrast; 
  462. $color = $this->getMaxContrastColor(); 
  463. $contrast = $color->getDistanceLuminosityFrom( $this ); 
  464.  
  465. // if current max contrast is less than the target contrast, we had wishful thinking. 
  466. if ( $contrast <= $target_contrast ) { 
  467. return $color; 
  468.  
  469. $incr = ( '#000000' === $color->toString() ) ? 1 : -1; 
  470. while ( $contrast > $target_contrast ) { 
  471. $color = $color->incrementLightness( $incr ); 
  472. $contrast = $color->getDistanceLuminosityFrom( $this ); 
  473.  
  474. return $color; 
  475.  
  476. /** 
  477. * Gets a readable contrasting color. $this is assumed to be the text and $color the background color. 
  478. * @param object $bg_color A Color object that will be compared against $this 
  479. * @param integer $min_contrast The minimum contrast to achieve, if possible. 
  480. * @return object A Color object, an increased contrast $this compared against $bg_color 
  481. */ 
  482. public function getReadableContrastingColor( $bg_color = false, $min_contrast = 5 ) { 
  483. if ( ! $bg_color || ! is_a( $bg_color, 'Jetpack_Color' ) ) { 
  484. return $this; 
  485. // you shouldn't use less than 5, but you might want to. 
  486. $target_contrast = $min_contrast; 
  487. // working things 
  488. $contrast = $bg_color->getDistanceLuminosityFrom( $this ); 
  489. $max_contrast_color = $bg_color->getMaxContrastColor(); 
  490. $max_contrast = $max_contrast_color->getDistanceLuminosityFrom( $bg_color ); 
  491.  
  492. // if current max contrast is less than the target contrast, we had wishful thinking. 
  493. // still, go max 
  494. if ( $max_contrast <= $target_contrast ) { 
  495. return $max_contrast_color; 
  496. // or, we might already have sufficient contrast 
  497. if ( $contrast >= $target_contrast ) { 
  498. return $this; 
  499.  
  500. $incr = ( 0 === $max_contrast_color->toInt() ) ? -1 : 1; 
  501. while ( $contrast < $target_contrast ) { 
  502. $this->incrementLightness( $incr ); 
  503. $contrast = $bg_color->getDistanceLuminosityFrom( $this ); 
  504. // infininite loop prevention: you never know. 
  505. if ( $this->color === 0 || $this->color === 16777215 ) { 
  506. break; 
  507.  
  508. return $this; 
  509.  
  510. /** 
  511. * Detect if color is grayscale 
  512. * @param int @threshold 
  513. * @return bool 
  514. */ 
  515. public function isGrayscale($threshold = 16) 
  516. $rgb = $this->toRgbInt(); 
  517.  
  518. // Get min and max rgb values, then difference between them 
  519. $rgbMin = min($rgb); 
  520. $rgbMax = max($rgb); 
  521. $diff = $rgbMax - $rgbMin; 
  522.  
  523. return $diff < $threshold; 
  524.  
  525. /** 
  526. * Get the closest matching color from the given array of colors 
  527. * @param array $colors array of integers or Jetpack_Color objects 
  528. * @return mixed the array key of the matched color 
  529. */ 
  530. public function getClosestMatch(array $colors) 
  531. $matchDist = 10000; 
  532. $matchKey = null; 
  533. foreach($colors as $key => $color) { 
  534. if (false === ($color instanceof Jetpack_Color)) { 
  535. $c = new Jetpack_Color($color); 
  536. $dist = $this->getDistanceLabFrom($c); 
  537. if ($dist < $matchDist) { 
  538. $matchDist = $dist; 
  539. $matchKey = $key; 
  540.  
  541. return $matchKey; 
  542.  
  543. /** TRANSFORMS */ 
  544.  
  545. public function darken( $amount = 5 ) { 
  546. return $this->incrementLightness( - $amount ); 
  547.  
  548. public function lighten( $amount = 5 ) { 
  549. return $this->incrementLightness( $amount ); 
  550.  
  551. public function incrementLightness( $amount ) { 
  552. $hsl = $this->toHsl(); 
  553. extract( $hsl ); 
  554. $l += $amount; 
  555. if ( $l < 0 ) $l = 0; 
  556. if ( $l > 100 ) $l = 100; 
  557. return $this->fromHsl( $h, $s, $l ); 
  558.  
  559. public function saturate( $amount = 15 ) { 
  560. return $this->incrementSaturation( $amount ); 
  561.  
  562. public function desaturate( $amount = 15 ) { 
  563. return $this->incrementSaturation( - $amount ); 
  564.  
  565. public function incrementSaturation( $amount ) { 
  566. $hsl = $this->toHsl(); 
  567. extract( $hsl ); 
  568. $s += $amount; 
  569. if ( $s < 0 ) $s = 0; 
  570. if ( $s > 100 ) $s = 100; 
  571. return $this->fromHsl( $h, $s, $l ); 
  572.  
  573. public function toGrayscale() { 
  574. $hsl = $this->toHsl(); 
  575. extract( $hsl ); 
  576. $s = 0; 
  577. return $this->fromHsl( $h, $s, $l ); 
  578.  
  579. public function getComplement() { 
  580. return $this->incrementHue( 180 ); 
  581.  
  582. public function getSplitComplement( $step = 1 ) { 
  583. $incr = 180 + ( $step * 30 ); 
  584. return $this->incrementHue( $incr ); 
  585.  
  586. public function getAnalog( $step = 1 ) { 
  587. $incr = $step * 30; 
  588. return $this->incrementHue( $incr ); 
  589.  
  590. public function getTetrad( $step = 1 ) { 
  591. $incr = $step * 60; 
  592. return $this->incrementHue( $incr ); 
  593.  
  594. public function getTriad( $step = 1 ) { 
  595. $incr = $step * 120; 
  596. return $this->incrementHue( $incr ); 
  597.  
  598. public function incrementHue( $amount ) { 
  599. $hsl = $this->toHsl(); 
  600. extract( $hsl ); 
  601. $h = ( $h + $amount ) % 360; 
  602. if ( $h < 0 ) $h = 360 - $h; 
  603. return $this->fromHsl( $h, $s, $l ); 
  604.  
  605. } // class Jetpack_Color