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