| @@ 11-22 (lines=12) @@ | ||
| 8 | return (is_string($input) && preg_match('/\A\#?([0-9a-f]{6}|[0-9a-f]{3})\Z/i', $input)); |
|
| 9 | } |
|
| 10 | ||
| 11 | public static function rgb($input) { |
|
| 12 | if ( |
|
| 13 | is_array($input) |
|
| 14 | && static::has_keys($input, ['r', 'g', 'b']) |
|
| 15 | && static::in_range($input['r'], 0, 255) |
|
| 16 | && static::in_range($input['g'], 0, 255) |
|
| 17 | && static::in_range($input['b'], 0, 255) |
|
| 18 | ) { |
|
| 19 | return TRUE; |
|
| 20 | } |
|
| 21 | return FALSE; |
|
| 22 | } |
|
| 23 | ||
| 24 | public static function hsl($input) { |
|
| 25 | if ( |
|
| @@ 24-35 (lines=12) @@ | ||
| 21 | return FALSE; |
|
| 22 | } |
|
| 23 | ||
| 24 | public static function hsl($input) { |
|
| 25 | if ( |
|
| 26 | is_array($input) |
|
| 27 | && static::has_keys($input, ['h', 's', 'l']) |
|
| 28 | && static::in_range($input['h'], 0, 359) |
|
| 29 | && static::in_range($input['s'], 0, 100) |
|
| 30 | && static::in_range($input['l'], 0, 100) |
|
| 31 | ) { |
|
| 32 | return TRUE; |
|
| 33 | } |
|
| 34 | return FALSE; |
|
| 35 | } |
|
| 36 | ||
| 37 | public static function hsb($input) { |
|
| 38 | if ( |
|
| @@ 37-48 (lines=12) @@ | ||
| 34 | return FALSE; |
|
| 35 | } |
|
| 36 | ||
| 37 | public static function hsb($input) { |
|
| 38 | if ( |
|
| 39 | is_array($input) |
|
| 40 | && static::has_keys($input, ['h', 's', 'b']) |
|
| 41 | && static::in_range($input['h'], 0, 359) |
|
| 42 | && static::in_range($input['s'], 0, 100) |
|
| 43 | && static::in_range($input['b'], 0, 100) |
|
| 44 | ) { |
|
| 45 | return TRUE; |
|
| 46 | } |
|
| 47 | return FALSE; |
|
| 48 | } |
|
| 49 | ||
| 50 | public static function cmyk($input) { |
|
| 51 | if ( |
|