Dotfiles/docs/md/theming.md

141 lines
4.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# CyberQueer Theme System
The CyberQueer theme is a single-source colour system: every config file that needs colours references a small set of hex values that can be changed in one place and propagated everywhere with a single command.
---
## The Palette
Defined in `~/Dotfiles/colors.conf` (bare 6-digit hex, no `#` prefix):
```ini
COLOR_TEXT=D6ABAB # Rose-white — foreground text, labels
COLOR_BG=1A1A1A # Near-black — base surface, backgrounds
COLOR_HIGHLIGHT=E40046 # Hot pink — primary accent, active borders
COLOR_DARK=5018DD # Violet — secondary accent, inactive borders
COLOR_RED=F50505 # Red — danger indicators, alerts
```
---
## Applying the Theme
```bash
# Apply using the default colors.conf
bash ~/Dotfiles/apply-theme.sh
# Apply from a custom palette file
bash ~/Dotfiles/apply-theme.sh /path/to/custom-colors.conf
```
`apply-theme.sh` will:
1. Read `colors.conf` (or the file you pass)
2. Compare against the last-applied state in `~/.config/colors.state`
3. Replace only **changed** colour values across all tracked files
4. Save the new state to `colors.state`
If nothing changed it exits immediately — safe to call repeatedly.
### First-Run Bootstrap
On a fresh install where configs have been copied but no state file exists yet, `apply-theme.sh` bootstraps `~/.config/colors.state` with the repository defaults so the diff works correctly from the start.
---
## What Gets Themed
### User Configs (`~/.config/…`)
| File | What it styles |
|------|---------------|
| `starship.toml` | Shell prompt segment colours |
| `yazi/theme.toml` | File manager UI colours |
| `hypr/hyprland.conf` | Active/inactive window border gradients |
| `hypr/hyprtoolkit.conf` | Additional Hyprland colours |
| `hypr/hyprlock.conf` | Lock screen colours |
| `kitty/current-theme.conf` | Terminal colour palette |
| `kitty/kitty.conf` | Terminal background & accents |
| `kitty/themes/cyberqueer.conf` | Kitty colour scheme definition |
| `waybar/style.css` | Top bar widget colours |
| `wofi/style.css` | App launcher colours |
| `walker/themes/cyberqueer.css` | Walker launcher theme |
| `nwg-dock-hyprland/style.css` | Application dock |
| `nwg-drawer/drawer.css` | Application drawer |
| `nwg-panel/menu-start.css` | Panel start menu |
| `vicinae/cyberqueer.toml` | Gesture launcher |
| `scripts/onscreenkb.sh` | On-screen keyboard colours |
| `spicetify/Themes/*/color.ini` | Spotify client theme (×2 variants) |
| `ulauncher/user-themes/cyberqueer/manifest.json` | uLauncher theme |
| `ulauncher/user-themes/cyberqueer/theme.css` | uLauncher CSS |
| `ulauncher/user-themes/cyberqueer/generated.css` | uLauncher generated CSS |
| `Vencord/themes/cyberqueer.theme.css` | Discord theme |
| `Vencord/themes/system24/…/cyberqueer.theme.css` | Discord system24 variant |
### System Files (applied via `sudo`)
| File | What it styles |
|------|---------------|
| `/etc/ly/config.ini` | TUI login manager colours |
| `/usr/share/themes/cyberqueer/gtk-3.0/gtk.css` | GTK 3 theme |
| `/usr/share/themes/cyberqueer/gtk-4.0/gtk.css` | GTK 4 theme |
---
## Customising the Palette
Edit `~/Dotfiles/colors.conf`, then run `apply-theme.sh`:
```bash
# Example: shift the accent to cyan
nano ~/Dotfiles/colors.conf
# → COLOR_HIGHLIGHT=00B4D8
bash ~/Dotfiles/apply-theme.sh
```
The tui-install.sh installer also offers a colorway dialog as its final step:
enter new hex values in the form; leave them unchanged to skip.
---
## How It Works Internally
`apply-theme.sh` reads two keyvalue files and computes the diff:
```
~/.config/colors.state (old values — what's currently applied)
colors.conf (new values — what you want)
```
For each changed key it runs:
```bash
sed -i "s/${OLD_HEX}/${NEW_HEX}/gI" <file>
```
The case-insensitive (`I`) flag matches uppercase hex codes that some apps emit. After all replacements succeed, `colors.state` is updated.
### Symlink Guard
`apply-theme.sh` refuses to run if any deployed config path resolves back into `~/Dotfiles/` via symlink. This prevents theme changes from being committed directly into the git repository. The new-style install (via `tui-install.sh`) **copies** configs instead of symlinking them, so this guard is normally never triggered.
---
## Answerfile Theming
If you generate an answerfile with `generate-answerfile.sh`, custom colours can be embedded in it:
```json
{
"colors": {
"COLOR_TEXT": "D6ABAB",
"COLOR_BG": "1A1A1A",
"COLOR_HIGHLIGHT": "E40046",
"COLOR_DARK": "5018DD",
"COLOR_RED": "F50505"
}
}
```
`tui-install.sh` will apply these at the end of an automated install.