add apply-theme.sh and colors.conf; copy both at install

- New apply-theme.sh: reads colors.conf, diffs against saved state,
  applies changed hex values across all 26 theme files via sed.
  Refuses to run when any deployed config is symlinked back to ~/Dotfiles
  to prevent theme changes from propagating into the git repo.
- New colors.conf: editable color source with the default CyberQueer palette.
- hyprland.sh + hyprland-new.sh: copy colors.conf to ~/.config/ and
  apply-theme.sh to ~/ at install (instead of symlinking colors.conf).
- sway.sh: wire colors.conf into the sway install path.
- doc/colorcodes.md: rewritten as structured color reference with format table.

Theme source files in the repo are unchanged from upstream (E40046 palette).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
The_miro 2026-05-11 14:25:57 +02:00
parent e468ddcdae
commit 3b6e0cfff0
6 changed files with 281 additions and 7 deletions

210
apply-theme.sh Executable file
View File

@ -0,0 +1,210 @@
#!/bin/bash
# Apply theme colors from ~/.config/colors.conf to all deployed dotfile configs.
#
# Guards:
# - Refuses if any deployed config is symlinked back to ~/Dotfiles (old-style
# install), to prevent theme changes from propagating into the git repo.
# - When configs are copied into ~/.config (new-style install), overwrites
# those copies in-place.
#
# Tracks last-applied state in ~/.config/colors.state so only changed colors
# trigger replacements. Run again after re-install to re-apply your theme.
#
# Usage: ~/apply-theme.sh [/path/to/colors.conf]
set -euo pipefail
DOTFILES="${DOTFILES:-$HOME/Dotfiles}"
COLORS_CONF="${1:-$HOME/.config/colors.conf}"
STATE_FILE="$HOME/.config/colors.state"
# Hardcoded defaults — the values baked into every source file in the repo.
# Used to bootstrap colors.state on first run after a fresh install.
BOOT_TEXT="D6ABAB"
BOOT_BG="1A1A1A"
BOOT_HIGHLIGHT="E40046"
BOOT_DARK="5018DD"
BOOT_RED="F50505"
# "dotfiles_relative_path|absolute_deployed_path"
USER_FILES=(
"starship.toml|$HOME/.config/starship.toml"
"yazi/theme.toml|$HOME/.config/yazi/theme.toml"
"desktopenvs/hyprland/hypr/hyprland.conf|$HOME/.config/hypr/hyprland.conf"
"desktopenvs/hyprland/hypr/hyprtoolkit.conf|$HOME/.config/hypr/hyprtoolkit.conf"
"desktopenvs/hyprland/hypr/hyprlock.conf|$HOME/.config/hypr/hyprlock.conf"
"desktopenvs/hyprland/kitty/current-theme.conf|$HOME/.config/kitty/current-theme.conf"
"desktopenvs/hyprland/kitty/kitty.conf|$HOME/.config/kitty/kitty.conf"
"desktopenvs/hyprland/kitty/themes/cyberqueer.conf|$HOME/.config/kitty/themes/cyberqueer.conf"
"desktopenvs/hyprland/waybar/style.css|$HOME/.config/waybar/style.css"
"desktopenvs/hyprland/wofi/style.css|$HOME/.config/wofi/style.css"
"desktopenvs/hyprland/walker/themes/cyberqueer.css|$HOME/.config/walker/themes/cyberqueer.css"
"desktopenvs/hyprland/nwg-dock-hyprland/style.css|$HOME/.config/nwg-dock-hyprland/style.css"
"desktopenvs/hyprland/nwg-drawer/drawer.css|$HOME/.config/nwg-drawer/drawer.css"
"desktopenvs/hyprland/nwg-panel/menu-start.css|$HOME/.config/nwg-panel/menu-start.css"
"desktopenvs/hyprland/vicinae/cyberqueer.toml|$HOME/.config/vicinae/cyberqueer.toml"
"desktopenvs/hyprland/scripts/onscreenkb.sh|$HOME/.config/scripts/onscreenkb.sh"
"desktopenvs/hyprland/spicetify/Themes/cli-cyberqueer/color.ini|$HOME/.config/spicetify/Themes/cli-cyberqueer/color.ini"
"desktopenvs/hyprland/spicetify/Themes/matte-cyberqueer/color.ini|$HOME/.config/spicetify/Themes/matte-cyberqueer/color.ini"
"desktopenvs/hyprland/ulauncher/user-themes/cyberqueer/manifest.json|$HOME/.config/ulauncher/user-themes/cyberqueer/manifest.json"
"desktopenvs/hyprland/ulauncher/user-themes/cyberqueer/theme.css|$HOME/.config/ulauncher/user-themes/cyberqueer/theme.css"
"desktopenvs/hyprland/ulauncher/user-themes/cyberqueer/generated.css|$HOME/.config/ulauncher/user-themes/cyberqueer/generated.css"
"desktopenvs/hyprland/Vencord/themes/cyberqueer.theme.css|$HOME/.config/Vencord/themes/cyberqueer.theme.css"
"desktopenvs/hyprland/Vencord/themes/system24/theme/flavors/cyberqueer.theme.css|$HOME/.config/Vencord/themes/system24/theme/flavors/cyberqueer.theme.css"
)
# System-owned paths — sed is run via sudo
SYS_FILES=(
"etc-ly-config.ini|/etc/ly/config.ini"
"gtk-themes/cyberqueer/gtk-3.0/gtk.css|/usr/share/themes/cyberqueer/gtk-3.0/gtk.css"
"gtk-themes/cyberqueer/gtk-4.0/gtk.css|/usr/share/themes/cyberqueer/gtk-4.0/gtk.css"
)
# ---------------------------------------------------------------------------
die() { echo "error: $*" >&2; exit 1; }
parse_colors() {
local file="$1"
[[ -f "$file" ]] || die "not found: $file"
while IFS='=' read -r key val; do
key="${key%%[[:space:]]*}"
[[ "$key" =~ ^[[:space:]]*# || -z "$key" ]] && continue
val="${val%%#*}"
val="${val//[[:space:]]/}"
val="${val^^}"
printf '%s=%s\n' "$key" "$val"
done < "$file"
}
# Returns 0 if any path component of $1 is a symlink pointing into DOTFILES
links_into_dotfiles() {
local path="$1"
while [[ "${#path}" -gt 1 ]]; do
if [[ -L "$path" ]]; then
local target
target=$(readlink -f "$path" 2>/dev/null) || break
[[ "$target" == "$DOTFILES"/* || "$target" == "$DOTFILES" ]] && return 0
fi
[[ "$path" == "$HOME" ]] && break
path=$(dirname "$path")
done
return 1
}
# Run sed -i with optional command prefix (e.g. "sudo").
# Called as: do_replace <file> [sudo]
do_replace() {
local file="$1"
shift # remaining "$@" is either empty or "sudo"
for key in "${CHANGED_KEYS[@]}"; do
local old="${OLD[$key]:-}"
local new="${NEW[$key]}"
[[ -z "$old" || "$old" == "$new" ]] && continue
"$@" sed -i "s/${old}/${new}/gI" "$file"
done
}
# ---------------------------------------------------------------------------
# Bootstrap state on fresh install (deployed files still have default colors)
if [[ ! -f "$STATE_FILE" ]]; then
cat > "$STATE_FILE" <<EOF
COLOR_TEXT=$BOOT_TEXT
COLOR_BG=$BOOT_BG
COLOR_HIGHLIGHT=$BOOT_HIGHLIGHT
COLOR_DARK=$BOOT_DARK
COLOR_RED=$BOOT_RED
EOF
echo "Created $STATE_FILE with default CyberQueer colors"
fi
# ---------------------------------------------------------------------------
# Symlink guard — refuse if any deployed path traces back to the git repo
SYMLINKED=()
for entry in "${USER_FILES[@]}"; do
deployed="${entry#*|}"
[[ -e "$deployed" ]] || continue
links_into_dotfiles "$deployed" && SYMLINKED+=("$deployed")
done
if [[ ${#SYMLINKED[@]} -gt 0 ]]; then
echo "error: the following deployed configs are symlinked back to $DOTFILES:"
printf ' %s\n' "${SYMLINKED[@]}"
cat <<'EOF'
Modifying these would write theme changes directly into the git repo.
Re-install using setup/modules/Desktop-Enviroments/hyprland-new.sh,
which copies configs instead of symlinking them.
To convert a single directory manually:
cp -rL ~/.config/hypr /tmp/hypr && rm -rf ~/.config/hypr && mv /tmp/hypr ~/.config/hypr
EOF
exit 1
fi
# ---------------------------------------------------------------------------
# Load and diff colors
declare -A OLD NEW
while IFS='=' read -r k v; do OLD[$k]="$v"; done < <(parse_colors "$STATE_FILE")
while IFS='=' read -r k v; do NEW[$k]="$v"; done < <(parse_colors "$COLORS_CONF")
CHANGED_KEYS=()
for key in "${!NEW[@]}"; do
[[ "${OLD[$key]:-}" != "${NEW[$key]}" ]] && CHANGED_KEYS+=("$key")
done
if [[ ${#CHANGED_KEYS[@]} -eq 0 ]]; then
echo "No color changes — nothing to do."
exit 0
fi
echo "Changes to apply:"
for key in "${CHANGED_KEYS[@]}"; do
printf ' %-20s #%s → #%s\n' "$key" "${OLD[$key]:-?}" "${NEW[$key]}"
done
echo
# ---------------------------------------------------------------------------
# Apply to user files
u_ok=0; u_skip=0
for entry in "${USER_FILES[@]}"; do
deployed="${entry#*|}"
if [[ ! -f "$deployed" ]]; then
u_skip=$((u_skip + 1))
continue
fi
do_replace "$deployed"
u_ok=$((u_ok + 1))
done
# ---------------------------------------------------------------------------
# Apply to system files (sudo)
s_ok=0; s_skip=0
for entry in "${SYS_FILES[@]}"; do
deployed="${entry#*|}"
if [[ ! -f "$deployed" ]]; then
s_skip=$((s_skip + 1))
continue
fi
if do_replace "$deployed" sudo; then
s_ok=$((s_ok + 1))
else
echo " SKIP (sudo failed): $deployed"
s_skip=$((s_skip + 1))
fi
done
# ---------------------------------------------------------------------------
# Persist state
cp "$COLORS_CONF" "$STATE_FILE"
echo "User files: $u_ok updated, $u_skip not installed."
[[ $((s_ok + s_skip)) -gt 0 ]] && echo "System files: $s_ok updated, $s_skip not installed."
echo "State saved → $STATE_FILE"

9
colors.conf Normal file
View File

@ -0,0 +1,9 @@
# CyberQueer Theme Colors
# Edit values, then run: ~/Dotfiles/apply-theme.sh
# Bare 6-digit hex values only (no # prefix)
COLOR_TEXT=D6ABAB # Quasi-White Text — foreground, labels
COLOR_BG=1A1A1A # Gray Background — base surface
COLOR_HIGHLIGHT=E40046 # Hot Pink Accent — primary accent, active borders
COLOR_DARK=5018DD # Electric Violet — secondary accent, inactive borders
COLOR_RED=F50505 # Red Hi-vis — danger, alerts

View File

@ -1,6 +1,53 @@
name Hex rgb rgb% HSV HSL
Quasi-White Text: #D6ABAB rgb(214 171 171) 84%, 67%, 67% 0°, 20%, 84% 0°, 34%, 75%
Gray BG: #1A1A1A rgb(26 26 26) 10%, 10%, 10% 0°, 0%, 10% 0°, 0%, 10%
Highlights: #E40046 rgb(228 0 70) 89%, 0%, 27% 342°, 100%, 89% 342°, 100%, 45%
Dark: #5018DD rgb(80 24 221) 31%, 9%, 87% 257°, 89%, 87% 257°, 80%, 48%
Red-Hivis: #F50505 rgb(245 5 5) 96%, 2%, 2% 0°, 98%, 96% 0°, 96%, 49%
# CyberQueer Theme — Color Reference
Colors are centrally defined in `~/Dotfiles/colors.conf` (symlinked to `~/.config/colors.conf`).
## Current palette
| Name | Variable | Hex | Role |
|-----------------|-------------------|-----------|-----------------------------------|
| Quasi-White Text | `COLOR_TEXT` | `#D6ABAB` | Foreground, labels |
| Gray BG | `COLOR_BG` | `#1A1A1A` | Base surface |
| Hot Pink Accent | `COLOR_HIGHLIGHT`| `#E40046` | Primary accent, active borders |
| Electric Violet | `COLOR_DARK` | `#5018DD` | Secondary accent, inactive borders|
| Red Hi-vis | `COLOR_RED` | `#F50505` | Danger, alerts |
## Changing the theme
1. Edit `~/Dotfiles/colors.conf` (or `~/.config/colors.conf`)
2. Run `~/Dotfiles/apply-theme.sh`
The script replaces the old hex values with the new ones across all 26 theme files and saves the applied state to `~/.config/colors.state`.
## Affected files
- `starship.toml`
- `etc-ly-config.ini`
- `yazi/theme.toml`
- `gtk-themes/cyberqueer/gtk-{3,4}.0/gtk.css`
- `desktopenvs/hyprland/hypr/{hyprland,hyprtoolkit,hyprlock}.conf`
- `desktopenvs/hyprland/kitty/{kitty,current-theme}.conf` + `themes/cyberqueer.conf`
- `desktopenvs/hyprland/waybar/style.css`
- `desktopenvs/hyprland/wofi/style.css`
- `desktopenvs/hyprland/walker/themes/cyberqueer.css`
- `desktopenvs/hyprland/nwg-{dock-hyprland,drawer,panel}/style.css`
- `desktopenvs/hyprland/vicinae/cyberqueer.toml`
- `desktopenvs/hyprland/scripts/onscreenkb.sh`
- `desktopenvs/hyprland/spicetify/Themes/{cli,matte}-cyberqueer/color.ini`
- `desktopenvs/hyprland/ulauncher/user-themes/cyberqueer/{manifest.json,theme.css,generated.css}`
- `desktopenvs/hyprland/Vencord/themes/cyberqueer.theme.css`
- `desktopenvs/hyprland/Vencord/themes/system24/theme/flavors/cyberqueer.theme.css`
## Color formats handled automatically
The script replaces the bare 6-char hex value (case-insensitive) everywhere it appears,
which covers all formats used across the configs:
| Format | Example | Used in |
|------------------|----------------------|-----------------------|
| `#RRGGBB` | `#E40046` | CSS, TOML, JSON |
| bare hex | `E40046` | spicetify `.ini` |
| `rgb(RRGGBB)` | `rgb(E40046)` | Hyprland conf |
| `rgba(RRGGBBaa)` | `rgba(1a1a1aee)` | Hyprland conf |
| `0xRRGGBB` | `0x005018DD` | ly login manager |
| shell args | `--press E40046` | wvkbd script |

View File

@ -96,6 +96,7 @@ for cfg in "${CONFIGS[@]}"; do
done
cp ~/Dotfiles/desktopenvs/hyprland/hypr-usr/* ~/.config/
cp ~/Dotfiles/colors.conf ~/.config/colors.conf
# 11. Wallpaper and resources
mkdir -p ~/Pictures
@ -122,10 +123,12 @@ fi
sudo systemctl enable udiskie.service
sudo systemctl start udiskie.service
# 15. Install config updater
# 15. Install config updater and theme script
mkdir -p ~/.config/config-updater
ln -sf ~/Dotfiles/desktopenvs/hyprland/config-updater/updater.conf ~/.config/config-updater/updater.conf
ln -sf ~/Dotfiles/desktopenvs/hyprland/config-updater/update-configs.sh ~/update-configs.sh
cp ~/Dotfiles/apply-theme.sh ~/apply-theme.sh
chmod +x ~/apply-theme.sh
# 16. WallRizz (run manually after login — requires a running desktop session)
# curl -sL "$(curl -s https://api.github.com/repos/5hubham5ingh/WallRizz/releases/latest \

View File

@ -97,6 +97,10 @@ ln -s ~/Dotfiles/desktopenvs/hyprland/gtk-3.0 ~/.config
#ln -s ~/Dotfiles/desktopenvs/hyprland/eww/ ~/.config/
#ln -s ~/Dotfiles/desktopenvs/hyprland/eww-nobattery/ ~/.config/eww
cp ~/Dotfiles/colors.conf ~/.config/colors.conf
cp ~/Dotfiles/apply-theme.sh ~/apply-theme.sh
chmod +x ~/apply-theme.sh
cp ~/Dotfiles/resources/fflogo.svg ~/Pictures/fflogo.svg
cp ~/Dotfiles/desktopenvs/hyprland/hypr-usr/* ~/.config

View File

@ -61,6 +61,7 @@ sudo systemctl enable greetd.service
# Dotfiles
echo "Linking dotfiles..."
ln -sf ~/Dotfiles/colors.conf ~/.config/colors.conf
rm -f ~/.bashrc ~/.zshrc
ln -sf ~/Dotfiles/.bashrc ~/.bashrc
ln -sf ~/Dotfiles/.zshrc ~/.zshrc