1 | <?php |
||
7 | class generate { |
||
8 | |||
9 | 1 | public static function rgb_contrast(int $r = 0, int $g = 0, int $b = 0) :array { |
|
10 | return [ |
||
11 | 1 | 'r' => ($r < 128) ? 255 : 0, |
|
12 | 1 | 'g' => ($g < 128) ? 255 : 0, |
|
13 | 1 | 'b' => ($b < 128) ? 255 : 0 |
|
14 | ]; |
||
15 | } |
||
16 | |||
17 | 1 | public static function rgb_invert(int $r = 0, int $g = 0, int $b = 0) :array { |
|
24 | |||
25 | 2 | public static function yiq_score(int $r = 0, int $g = 0, int $b = 0) :float { |
|
28 | |||
29 | public static function rgb_rand(int $min_r = 0, int $max_r = 255, int $min_g = 0, int $max_g = 255, int $min_b = 0, int $max_b = 255) :array { |
||
36 | |||
37 | public static function hsl_rand(int $min_h = 0, int $max_h = 255, int $min_s = 0, int $max_s = 255, int $min_l = 0, int $max_l = 255) :array { |
||
44 | |||
45 | 1 | public static function blend(float $r1, float $g1, float $b1, float $a1, float $r2, float $g2, float $b2, float $a2, float $amount = 50.0) :array { |
|
55 | |||
56 | public static function web_safe(int $r = 0, int $g = 0, int $b = 0) :string { |
||
63 | } |
||
64 |