From d3a50b0bc09b6d66eed3c8019011fd78fc0f78a1 Mon Sep 17 00:00:00 2001 From: Magnus Hoff Date: Thu, 19 Jul 2018 08:53:05 +0200 Subject: [PATCH] Iterate on color schemes. Improve descision of proper contrast --- assets/themes.css | 29 +++++++++++++++-------------- themes/generate.py | 18 ++++++++++++++---- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/assets/themes.css b/assets/themes.css index 721eb4c..0861d43 100644 --- a/assets/themes.css +++ b/assets/themes.css @@ -48,9 +48,9 @@ } .theme-cyan { - --theme-main: #00BCD4; + --theme-main: #0097A7; --theme-text: white; - --theme-input: #4DD0E1; + --theme-input: #00BCD4; --theme-link: #90CAF9; } @@ -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; } @@ -131,3 +131,4 @@ --theme-link: #90CAF9; } + diff --git a/themes/generate.py b/themes/generate.py index a69b3c4..eac797c 100755 --- a/themes/generate.py +++ b/themes/generate.py @@ -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], } @@ -54,4 +62,6 @@ print( ) ) +print() + # print("[" + ', '.join('"'+x['name']+'"' for x in themes) + "]")