Iterate on themes

Select yellow alternate colors for some hues where blue works poorly
This commit is contained in:
Magnus Hoff 2018-07-21 11:54:03 +02:00
parent c18b8f45d1
commit 53e983bee9
2 changed files with 16 additions and 6 deletions

View file

@ -2,14 +2,14 @@
--theme-main: #F44336;
--theme-text: white;
--theme-input: #E57373;
--theme-link: #90CAF9;
--theme-link: #FFF59D;
}
.theme-pink {
--theme-main: #E91E63;
--theme-text: white;
--theme-input: #F06292;
--theme-link: #90CAF9;
--theme-link: #FFF59D;
}
.theme-purple {
@ -100,21 +100,21 @@
--theme-main: #FB8C00;
--theme-text: white;
--theme-input: #FFA726;
--theme-link: #90CAF9;
--theme-link: #FFF59D;
}
.theme-deep-orange {
--theme-main: #FF5722;
--theme-text: white;
--theme-input: #FF8A65;
--theme-link: #90CAF9;
--theme-link: #FFF59D;
}
.theme-brown {
--theme-main: #795548;
--theme-text: white;
--theme-input: #A1887F;
--theme-link: #90CAF9;
--theme-link: #FFF59D;
}
.theme-gray {

View file

@ -25,6 +25,8 @@ def prep(x):
cols = x['colors']
rgb = [hex_to_rgb(c[1:]) for c in cols]
brightness = [luma(c) for c in rgb]
hue = [colorsys.rgb_to_hsv(*c)[0] * 360 for c in rgb]
sat = [colorsys.rgb_to_hsv(*c)[1] for c in rgb]
main_index = 5
if brightness[main_index] >= 0.4:
@ -34,15 +36,23 @@ def prep(x):
input_index = main_index + (-2 if dark_main else 1)
h = hue[main_index]
s = sat[main_index]
alt = blues
if s > 0.3 and (h < 40 or h >= 300):
alt = yellows
return {
"name": x['shade'].lower().replace(' ', '-'),
"main": cols[main_index],
"input": cols[input_index],
"text": "white",
"link": blues[2] if dark_main else blues[7],
"link": alt[2 if dark_main else 7],
}
blues = [x for x in palettes if x['shade'] == "Blue"][0]["colors"]
yellows = [x for x in palettes if x['shade'] == "Yellow"][0]["colors"]
themes = [prep(palette) for palette in palettes]