From 53e983bee9784cf1d421a355fe672efc239ccf67 Mon Sep 17 00:00:00 2001 From: Magnus Hoff Date: Sat, 21 Jul 2018 11:54:03 +0200 Subject: [PATCH] Iterate on themes Select yellow alternate colors for some hues where blue works poorly --- assets/themes.css | 10 +++++----- themes/generate.py | 12 +++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/assets/themes.css b/assets/themes.css index 9a225dc..5f2e035 100644 --- a/assets/themes.css +++ b/assets/themes.css @@ -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 { diff --git a/themes/generate.py b/themes/generate.py index c6fa40b..f312b79 100755 --- a/themes/generate.py +++ b/themes/generate.py @@ -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]