aboutsummaryrefslogtreecommitdiffstats
path: root/bin/udt-accent
diff options
context:
space:
mode:
Diffstat (limited to 'bin/udt-accent')
-rwxr-xr-xbin/udt-accent49
1 files changed, 12 insertions, 37 deletions
diff --git a/bin/udt-accent b/bin/udt-accent
index 7949597..1a222b5 100755
--- a/bin/udt-accent
+++ b/bin/udt-accent
@@ -21,25 +21,12 @@ import sys
import tempfile
from pathlib import Path
-# The candidate accents. rosewater and flamingo are excluded as near-neutral
-# tints that capture saturated inputs, and maroon and sapphire as near-duplicate
-# hues of red and sky. lavender sits close to mauve but is kept: it is the
-# desktop-wide fallback, used by Qt, GTK and anything else that needs one fixed
-# accent, so it has to be a value snap() can also return.
-ACCENTS = {
- "pink": "#f5bde6",
- "mauve": "#c6a0f6",
- "lavender": "#b7bdf8",
- "red": "#ed8796",
- "peach": "#f5a97f",
- "yellow": "#eed49f",
- "green": "#a6da95",
- "teal": "#8bd5ca",
- "sky": "#91d7e3",
- "blue": "#8aadf4",
-}
-
-FALLBACK = "lavender"
+# The colour tables are generated: udt-palette renders them from
+# palette/<scheme>.conf and palette/roles-<scheme>.conf, so the accents this
+# snaps to follow whatever scheme is selected. Regenerate with ./install.sh.
+sys.path.insert(0, str(Path(__file__).resolve().parent))
+from udt_colors import ACCENTS, FALLBACK, PALETTE # noqa: E402
+
MIN_CHROMA = 10.0
OUTPUT = Path.home() / ".cache" / "wal" / "udt-accent.rasi"
@@ -47,24 +34,12 @@ BORDER_OUTPUT = Path.home() / ".cache" / "wal" / "udt-border.lua"
DUNSTRC = Path.home() / ".cache" / "wal" / "dunstrc"
QML_OUTPUT = Path.home() / ".cache" / "wal" / "udt-palette.qml"
-# The installed palette, which is a symlink back into this repo. Read rather
-# than duplicated: palette.rasi is the one place the structural colours are
-# written down, and a second copy here would drift the first time one changed.
+# The installed rofi palette, itself generated by udt-palette. Read rather than
+# duplicated so the QML singleton carries exactly the colours rofi uses, under
+# the same names.
PALETTE_RASI = Path.home() / ".config" / "rofi" / "udt" / "palette.rasi"
COLORS_JSON = Path.home() / ".cache" / "wal" / "colors.json"
-# Catppuccin Macchiato, in pywal's slot order. Firefox is themed from this
-# via pywalfox, which reads colors.json and nothing else.
-MACCHIATO = {
- "background": "#24273a", "foreground": "#cad3f5", "cursor": "#f4dbd6",
- "colors": [
- "#494d64", "#ed8796", "#a6da95", "#eed49f",
- "#8aadf4", "#f5bde6", "#8bd5ca", "#b8c0e0",
- "#5b6078", "#ed8796", "#a6da95", "#eed49f",
- "#8aadf4", "#f5bde6", "#8bd5ca", "#a5adcb",
- ],
-}
-
def write_atomic(path, content):
"""Write a file atomically, so no reader ever sees it half-written.
@@ -256,7 +231,7 @@ def write_colors_json(name, image):
palette stays fixed Macchiato while only the accent moves.
"""
hexval = ACCENTS[name]
- colors = list(MACCHIATO["colors"])
+ colors = list(PALETTE["colors"])
# Slots 4 and 12 are pywalfox's link/highlight colour.
colors[4] = colors[12] = hexval
@@ -267,8 +242,8 @@ def write_colors_json(name, image):
"wallpaper": os.path.realpath(image),
"alpha": "100",
"special": {
- "background": MACCHIATO["background"],
- "foreground": MACCHIATO["foreground"],
+ "background": PALETTE["background"],
+ "foreground": PALETTE["foreground"],
"cursor": hexval,
},
"colors": {f"color{i}": c for i, c in enumerate(colors)},