Created
April 29, 2025 13:16
-
-
Save NoRaincheck/22cb4d70cc2d03f8d853576ff180f500 to your computer and use it in GitHub Desktop.
Rainbow Colour Scheme - a start of something.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import cycle | |
# the colors cycle in 3 different "rates" | |
def linspace(start, stop, num): | |
"""Generate num evenly spaced numbers over the interval [start, stop].""" | |
if num < 2: | |
return [start] | |
step = (stop - start) / (num - 1) | |
return [start + step * i for i in range(num)] | |
ok_cycle = [float(x) for x in linspace(0.44, 0.82, 6) + linspace(0.82, 0.44, 6)[1:-1]] | |
l_cycle = [float(x) for x in linspace(0.182, 0.13, 3) + linspace(0.13, 0.182, 3)[1:-1]] | |
ch_cycle = [float(x) for x in linspace(8, 335, 12)] | |
def offset_cycle(cycle, offset): | |
return cycle[offset:] + cycle[:offset] | |
i = 0 | |
for ok, l, ch in zip( | |
cycle(offset_cycle(ok_cycle, 1)), | |
cycle(offset_cycle(l_cycle, 4)), | |
cycle(offset_cycle(ch_cycle, 11)), | |
): | |
print(f'"oklch({ok:.2f} {l:.2f} {ch:.02f})",') | |
i += 1 | |
if i >= 12: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment