@@ 50-61 (lines=12) @@ | ||
47 | * @param bool|null $is_dark Whether or not to treat the base color as a dark color. Leave as null to dynamically generate this. |
|
48 | * @return array An array of 5 complementary colors where the first offset is the original input. |
|
49 | */ |
|
50 | public static function complementary_set (float $h = 0, float $s = 0, float $l = 0, $is_dark = NULL) :array { |
|
51 | static::is_dark($is_dark, $h, $s, $l); |
|
52 | $al = static::alt_light($l); |
|
53 | $as = static::alt_saturation($s); |
|
54 | return [ |
|
55 | [$h, $s, $l], |
|
56 | [$h, $as, static::mod($al, 20, $is_dark)], |
|
57 | [$h, $as, static::mod($al, 10, $is_dark)], |
|
58 | [static::mod($h, 185, TRUE, 360), $as, $al], |
|
59 | [static::mod($h, 185, TRUE, 360), $as, static::mod($al, 10, $is_dark)] |
|
60 | ]; |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * These colors use mathematical offsets that usually complement each other |
|
@@ 154-165 (lines=12) @@ | ||
151 | * @param bool|null $is_dark Whether or not to treat the base color as a dark color. Leave as null to dynamically generate this. |
|
152 | * @return array An array of 5 triangular colors where the first offset is the original input. |
|
153 | */ |
|
154 | public static function tetrad_set (float $h = 0, float $s = 0, float $l = 0, $is_dark = NULL) :array { |
|
155 | static::is_dark($is_dark, $h, $s, $l); |
|
156 | $al = static::alt_light($l); |
|
157 | $as = static::alt_saturation($s); |
|
158 | return [ |
|
159 | [$h, $s, $l], |
|
160 | [static::mod($h, 180, TRUE, 360), $as, $al], |
|
161 | [static::mod($h, 120, TRUE, 360), $as, $al], |
|
162 | [$h, $as, static::mod($al, 18, $is_dark)], |
|
163 | [static::mod($h, -120, TRUE, 360), $as, $al] |
|
164 | ]; |
|
165 | } |
|
166 | ||
167 | /** |
|
168 | * 3 of these colors are all similarly distanced from each other on a color |
|
@@ 179-190 (lines=12) @@ | ||
176 | * @param bool|null $is_dark Whether or not to treat the base color as a dark color. Leave as null to dynamically generate this. |
|
177 | * @return array An array of 5 triangular colors where the first offset is the original input. |
|
178 | */ |
|
179 | public static function weighted_tetrad_set (float $h = 0, float $s = 0, float $l = 0, $is_dark = NULL) :array { |
|
180 | static::is_dark($is_dark, $h, $s, $l); |
|
181 | $al = static::alt_light($l); |
|
182 | $as = static::alt_saturation($s); |
|
183 | return [ |
|
184 | [$h, $s, $l], |
|
185 | [static::mod($h, 160, TRUE, 360), $as, $al], |
|
186 | [static::mod($h, 80, TRUE, 360), $as, $al], |
|
187 | [$h, $as, static::mod($al, 18, $is_dark)], |
|
188 | [static::mod($h, -80, TRUE, 360), $as, $al] |
|
189 | ]; |
|
190 | } |
|
191 | ||
192 | /** |
|
193 | * These colors are all equally distanced from each other on a color wheel, |
|
@@ 202-213 (lines=12) @@ | ||
199 | * @param bool|null $is_dark Whether or not to treat the base color as a dark color. Leave as null to dynamically generate this. |
|
200 | * @return array An array of 5 triangular colors where the first offset is the original input. |
|
201 | */ |
|
202 | public static function triad_set (float $h = 0, float $s = 0, float $l = 0, $is_dark = NULL) :array { |
|
203 | static::is_dark($is_dark, $h, $s, $l); |
|
204 | $al = static::alt_light($l); |
|
205 | $as = static::alt_saturation($s); |
|
206 | return [ |
|
207 | [$h, $s, $l], |
|
208 | [static::mod($h, 120, TRUE, 360), $as, $al], |
|
209 | [$h, $as, static::mod($al, 18, $is_dark)], |
|
210 | [static::mod($h, -120, TRUE, 360), $as, $al], |
|
211 | [static::mod($h, -120, TRUE, 360), $as, static::mod($al, 18, $is_dark)] |
|
212 | ]; |
|
213 | } |
|
214 | ||
215 | /** |
|
216 | * These colors are all similarly distanced from each other on a color wheel, |
|
@@ 226-237 (lines=12) @@ | ||
223 | * @param bool|null $is_dark Whether or not to treat the base color as a dark color. Leave as null to dynamically generate this. |
|
224 | * @return array An array of 5 weighted triangular colors where the first offset is the original input. |
|
225 | */ |
|
226 | public static function weighted_triad_set (float $h = 0, float $s = 0, float $l = 0, $is_dark = NULL) :array { |
|
227 | static::is_dark($is_dark, $h, $s, $l); |
|
228 | $al = static::alt_light($l); |
|
229 | $as = static::alt_saturation($s); |
|
230 | return [ |
|
231 | [$h, $s, $l], |
|
232 | [static::mod($h, 80, TRUE, 360), $as, $al], |
|
233 | [$h, $as, static::mod($al, 18, $is_dark)], |
|
234 | [static::mod($h, -80, TRUE, 360), $as, $al], |
|
235 | [static::mod($h, -80, TRUE, 360), $as, static::mod($al, 18, $is_dark)] |
|
236 | ]; |
|
237 | } |
|
238 | ||
239 | /** |
|
240 | * 4 of these colors form a rectangle on a color wheel, and 1 color is an |
|
@@ 249-260 (lines=12) @@ | ||
246 | * @param bool|null $is_dark Whether or not to treat the base color as a dark color. Leave as null to dynamically generate this. |
|
247 | * @return array An array of 5 rectangular colors where the first offset is the original input. |
|
248 | */ |
|
249 | public static function rectangular_set (float $h = 0, float $s = 0, float $l = 0, $is_dark = NULL) :array { |
|
250 | static::is_dark($is_dark, $h, $s, $l); |
|
251 | $al = static::alt_light($l); |
|
252 | $as = static::alt_saturation($s); |
|
253 | return [ |
|
254 | [$h, $s, $l], |
|
255 | [static::mod($h, 216, TRUE, 360), $as, $al], |
|
256 | [static::mod($h, 180, TRUE, 360), $as, $al], |
|
257 | [$h, $as, static::mod($al, 18, $is_dark)], |
|
258 | [static::mod($h, 36, TRUE, 360), $as, $al] |
|
259 | ]; |
|
260 | } |
|
261 | ||
262 | /** |
|
263 | * This prevents non-base colors from having either a too high or too low |