|
@@ 48-57 (lines=10) @@
|
| 45 |
|
* @param bool|null $is_dark Whether or not to treat the base color as a dark color. Leave as null to dynamically generate this. |
| 46 |
|
* @return array An array of 5 complementary colors where the first offset is the original input. |
| 47 |
|
*/ |
| 48 |
|
public static function complementary (float $h = 0, float $s = 0, float $l = 0, $is_dark = NULL) :array { |
| 49 |
|
static::is_dark($is_dark, $h, $s, $l); |
| 50 |
|
return [ |
| 51 |
|
[$h, $s, $l], |
| 52 |
|
[$h, $s, static::mod($l, 20, $is_dark)], |
| 53 |
|
[$h, $s, static::mod($l, 10, $is_dark)], |
| 54 |
|
[static::mod($h, 185, TRUE, 360), $s, $l], |
| 55 |
|
[static::mod($h, 185, TRUE, 360), $s, static::mod($l, 10, $is_dark)] |
| 56 |
|
]; |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
/** |
| 60 |
|
* These colors use mathematical offsets that usually complement each other |
|
@@ 146-155 (lines=10) @@
|
| 143 |
|
* @param bool|null $is_dark Whether or not to treat the base color as a dark color. Leave as null to dynamically generate this. |
| 144 |
|
* @return array An array of 5 triangular colors where the first offset is the original input. |
| 145 |
|
*/ |
| 146 |
|
public static function tetrad (float $h = 0, float $s = 0, float $l = 0, $is_dark = NULL) :array { |
| 147 |
|
static::is_dark($is_dark, $h, $s, $l); |
| 148 |
|
return [ |
| 149 |
|
[$h, $s, $l], |
| 150 |
|
[static::mod($h, 180, TRUE, 360), $s, $l], |
| 151 |
|
[static::mod($h, 120, TRUE, 360), $s, $l], |
| 152 |
|
[$h, $s, static::mod($l, 18, $is_dark)], |
| 153 |
|
[static::mod($h, -120, TRUE, 360), $s, $l] |
| 154 |
|
]; |
| 155 |
|
} |
| 156 |
|
|
| 157 |
|
/** |
| 158 |
|
* 3 of these colors are all similarly distanced from each other on a color |
|
@@ 169-178 (lines=10) @@
|
| 166 |
|
* @param bool|null $is_dark Whether or not to treat the base color as a dark color. Leave as null to dynamically generate this. |
| 167 |
|
* @return array An array of 5 triangular colors where the first offset is the original input. |
| 168 |
|
*/ |
| 169 |
|
public static function weighted_tetrad (float $h = 0, float $s = 0, float $l = 0, $is_dark = NULL) :array { |
| 170 |
|
static::is_dark($is_dark, $h, $s, $l); |
| 171 |
|
return [ |
| 172 |
|
[$h, $s, $l], |
| 173 |
|
[static::mod($h, 160, TRUE, 360), $s, $l], |
| 174 |
|
[static::mod($h, 80, TRUE, 360), $s, $l], |
| 175 |
|
[$h, $s, static::mod($l, 18, $is_dark)], |
| 176 |
|
[static::mod($h, -80, TRUE, 360), $s, $l] |
| 177 |
|
]; |
| 178 |
|
} |
| 179 |
|
|
| 180 |
|
/** |
| 181 |
|
* These colors are all equally distanced from each other on a color wheel, |
|
@@ 190-199 (lines=10) @@
|
| 187 |
|
* @param bool|null $is_dark Whether or not to treat the base color as a dark color. Leave as null to dynamically generate this. |
| 188 |
|
* @return array An array of 5 triangular colors where the first offset is the original input. |
| 189 |
|
*/ |
| 190 |
|
public static function triad (float $h = 0, float $s = 0, float $l = 0, $is_dark = NULL) :array { |
| 191 |
|
static::is_dark($is_dark, $h, $s, $l); |
| 192 |
|
return [ |
| 193 |
|
[$h, $s, $l], |
| 194 |
|
[static::mod($h, 120, TRUE, 360), $s, $l], |
| 195 |
|
[$h, $s, static::mod($l, 18, $is_dark)], |
| 196 |
|
[static::mod($h, -120, TRUE, 360), $s, $l], |
| 197 |
|
[static::mod($h, -120, TRUE, 360), $s, static::mod($l, 18, $is_dark)] |
| 198 |
|
]; |
| 199 |
|
} |
| 200 |
|
|
| 201 |
|
/** |
| 202 |
|
* These colors are all similarly distanced from each other on a color wheel, |
|
@@ 212-221 (lines=10) @@
|
| 209 |
|
* @param bool|null $is_dark Whether or not to treat the base color as a dark color. Leave as null to dynamically generate this. |
| 210 |
|
* @return array An array of 5 weighted triangular colors where the first offset is the original input. |
| 211 |
|
*/ |
| 212 |
|
public static function weighted_triad (float $h = 0, float $s = 0, float $l = 0, $is_dark = NULL) :array { |
| 213 |
|
static::is_dark($is_dark, $h, $s, $l); |
| 214 |
|
return [ |
| 215 |
|
[$h, $s, $l], |
| 216 |
|
[static::mod($h, 80, TRUE, 360), $s, $l], |
| 217 |
|
[$h, $s, static::mod($l, 18, $is_dark)], |
| 218 |
|
[static::mod($h, -80, TRUE, 360), $s, $l], |
| 219 |
|
[static::mod($h, -80, TRUE, 360), $s, static::mod($l, 18, $is_dark)] |
| 220 |
|
]; |
| 221 |
|
} |
| 222 |
|
|
| 223 |
|
/** |
| 224 |
|
* 3 of these colors are all equally distanced from each other on a color |