aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/udt-palette17
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/udt-palette b/bin/udt-palette
index 09731de..f92a6b7 100755
--- a/bin/udt-palette
+++ b/bin/udt-palette
@@ -112,6 +112,17 @@ def rgb_array(c):
return f"[{r}, {g}, {b}]"
+def rgb_triple(c):
+ """`r, g, b` with spaces, which is how GTK's CSS writes an rgba() colour.
+
+ The rgba() helper below emits without spaces and wraps in rgb()/rgba(),
+ neither of which matches what the upstream GTK theme contains, so the
+ substitution is on the bare triple and the template keeps the rgba() call.
+ """
+ r, g, b, _ = c
+ return f"{r}, {g}, {b}"
+
+
def rgba(c):
r, g, b, a = c
return f"rgb({r},{g},{b})" if a == 100 else f"rgba({r},{g},{b},{a / 100:.2f})"
@@ -329,6 +340,12 @@ TYPORA_ROLES = ["bg", "bg_deep", "surface_alt", "fg", "fg_dim", "fg_faint",
"info", "highlight"]
+# The roles GTK's stylesheets reference. Both a hex and a decimal-triple form
+# of each is substituted, because the upstream theme writes colours both ways.
+GTK_ROLES = ["fg", "bg", "bg_alt", "bg_deep", "surface", "surface_alt",
+ "accent", "critical", "warning", "success", "highlight", "info",
+ "blue", "peach"]
+
KVANTUM_ROLES = ["bg", "bg_alt", "surface", "surface_alt", "surface_high",
"fg", "fg_dim", "fg_faint", "mid_high", "accent",
"accent_dim", "accent_bright", "highlight", "critical"]