From eea80c78cfce99b504b60acab8509fb49999bdc7 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Jun 2026 17:26:45 -0500 Subject: feat(theme-selector): two-column layout, contrast ratings, taller samples I restructured the page into ordered rows. The top row splits palette on the left and save / load theme on the right. The next row, "code/color assignments," puts the assignment table on the left and a single code sample on the right, picked by a language dropdown and recolored live from the assignments. The last row is the interface faces. I added a contrast column to the assignment table: each color's WCAG ratio on the current background plus an AAA / AA / FAIL rating, recomputed live and re-rated when the background changes. I also replaced the six-language scroll with the one-language picker, lengthened every sample to roughly the height of the assignment table, and renamed the title suffix to "theme." --- scripts/theme-selector/generate.py | 99 +++++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 39 deletions(-) (limited to 'scripts/theme-selector/generate.py') diff --git a/scripts/theme-selector/generate.py b/scripts/theme-selector/generate.py index 94910d1c..087920d4 100644 --- a/scripts/theme-selector/generate.py +++ b/scripts/theme-selector/generate.py @@ -1,4 +1,4 @@ -import json, re, os +import json, os HERE=os.path.dirname(os.path.abspath(__file__)) ns={} src=open(os.path.join(HERE,'samples.py')).read() @@ -38,8 +38,6 @@ UIMAP={"cursor":{"fg":None,"bg":"#a9b2bb"},"region":{"fg":None,"bg":"#264364"}, "show-paren-mismatch":{"fg":"#0d0b0a","bg":"#cb6b4d"},"link":{"fg":"#67809c","bg":None}, "error":{"fg":"#cb6b4d","bg":None},"warning":{"fg":"#e8bd30","bg":None}, "success":{"fg":"#5d9b86","bg":None},"vertical-border":{"fg":"#2f343a","bg":None}} -def cid(l): return re.sub(r'\W','',l) -code_cont="".join(f'

{l}

' for l in SAMPLES) HTML = """theme-selector -

Untitled: color palette

-

code samples

-
CODE_CONT
-

color → category — chip reassigns · N/B/I sets weight & slant · click a header to sort

-
color △stylecategory △example
-

UI / interface faces — foreground & background per face

-
faceforegroundbackgroundpreview
-

palette — add / remove / rename / drag to reorder

-
-
- - - - -
-

save / load theme

-
- +

Untitled: theme

+
+
+

palette

+
+
+ + + + +
+
+
+

save / load theme

+
+ +
+
+ + + +
+ +
-
- - - +

code/color assignments

+
+
+
color △stylecategory △examplecontrast
+
+
+
+

+ 
- +

interface faces

+
faceforegroundbackgroundpreview
""" -HTML=(HTML.replace("CODE_CONT",code_cont).replace("SAMPLES_J",json.dumps(SAMPLES)) +HTML=(HTML.replace("SAMPLES_J",json.dumps(SAMPLES)) .replace("PALETTE_J",json.dumps(PALETTE)).replace("CATS_J",json.dumps(CATS)) .replace("UIFACES_J",json.dumps(UI_FACES)).replace("UIMAP_J",json.dumps(UIMAP)) .replace("BOLD_J",json.dumps(BOLD)).replace("MAP_J",json.dumps(MAP))) -- cgit v1.2.3