Skip to content

Commit

Permalink
Iterate on color schemes.
Browse files Browse the repository at this point in the history
Improve descision of proper contrast
  • Loading branch information
maghoff committed Jul 19, 2018
1 parent d905c1a commit d3a50b0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
29 changes: 15 additions & 14 deletions assets/themes.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
}

.theme-cyan {
--theme-main: #00BCD4;
--theme-main: #0097A7;
--theme-text: white;
--theme-input: #4DD0E1;
--theme-input: #00BCD4;
--theme-link: #90CAF9;
}

Expand All @@ -69,37 +69,37 @@
}

.theme-light-green {
--theme-main: #8BC34A;
--theme-main: #689F38;
--theme-text: white;
--theme-input: #AED581;
--theme-input: #8BC34A;
--theme-link: #90CAF9;
}

.theme-lime {
--theme-main: #AFB42B;
--theme-text: white;
--theme-input: #CDDC39;
--theme-link: #90CAF9;
--theme-main: #D4E157;
--theme-text: black;
--theme-input: #E6EE9C;
--theme-link: #1976D2;
}

.theme-yellow {
--theme-main: #FBC02D;
--theme-main: #FFEE58;
--theme-text: black;
--theme-input: #FFEB3B;
--theme-input: #FFF59D;
--theme-link: #1976D2;
}

.theme-amber {
--theme-main: #FFC107;
--theme-main: #FFCA28;
--theme-text: black;
--theme-input: #FFD54F;
--theme-input: #FFE082;
--theme-link: #1976D2;
}

.theme-orange {
--theme-main: #FF9800;
--theme-main: #F57C00;
--theme-text: white;
--theme-input: #FFB74D;
--theme-input: #FF9800;
--theme-link: #90CAF9;
}

Expand Down Expand Up @@ -131,3 +131,4 @@
--theme-link: #90CAF9;
}


18 changes: 14 additions & 4 deletions themes/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,25 @@ def luma(rgb):
return (0.2126*r + 0.7152*g + 0.0722*b)

def prep(x):
cols = [x['colors'][5], x['colors'][7]]
cols = x['colors']
rgb = [hex_to_rgb(c[1:]) for c in cols]
brightness = [luma(c) for c in rgb]

main_index = 0 if brightness[0] < 0.6 else 1
dark_main = brightness[main_index] < 0.5
dark_main = True
main_index = 5
if brightness[main_index] >= 0.4:
main_index = 7

if brightness[main_index] >= 0.4:
dark_main = False
main_index = 4
if brightness[main_index] < 0.6:
main_index = 3

return {
"name": x['shade'].lower().replace(' ', '-'),
"main": cols[main_index],
"input": x['colors'][3 if main_index == 0 else 5],
"input": x['colors'][main_index - 2],
"text": "white" if dark_main else "black",
"link": blues[2] if dark_main else blues[7],
}
Expand All @@ -54,4 +62,6 @@ def prep(x):
)
)

print()

# print("[" + ', '.join('"'+x['name']+'"' for x in themes) + "]")

0 comments on commit d3a50b0

Please sign in to comment.