1 | <?php |
||
11 | class check { |
||
12 | |||
13 | /** |
||
14 | * Checks if a RGB color appears as a darker or lighter color using YIQ |
||
15 | * color weights |
||
16 | * |
||
17 | * @param int $r The red value |
||
18 | * @param int $g The green value |
||
19 | * @param int $b The blue value |
||
20 | * @param int $check_score The minimum score to check, a number in the range of 0 - 255 |
||
21 | * @return boolean If the YIQ score is >= $check_score returns FALSE, otherwise TRUE |
||
22 | */ |
||
23 | 31 | public static function is_dark(int $r = 0, int $g = 0, int $b = 0, int $check_score = 128) :bool { |
|
29 | |||
30 | /** |
||
31 | * Measures the visual contrast of 2 RGB colors. |
||
32 | * |
||
33 | * NOTE: most colors do not have a 100% contrasting opposite, but all colors |
||
34 | * do have a contrasting opposite that is at least 50%. |
||
35 | * |
||
36 | * @param array $rgb1 The first color, array where offsets 'r', 'g', & 'b' contain their respective values. |
||
37 | * @param array $rgb2 The second color, array where offsets 'r', 'g', & 'b' contain their respective values. |
||
38 | * @return float The visual contrast as a percentage (e.g. 12.345) |
||
39 | */ |
||
40 | 1 | public static function rgb_contrast($rgb1, $rgb2) { |
|
47 | } |
||
48 |