Skip to content

fix(zed): improve syntax highlighting readability + wire alt Matugen theme#86

Open
yukazakiri wants to merge 5 commits intosnowarch:mainfrom
yukazakiri:fix/zed-more-vibrant-theme
Open

fix(zed): improve syntax highlighting readability + wire alt Matugen theme#86
yukazakiri wants to merge 5 commits intosnowarch:mainfrom
yukazakiri:fix/zed-more-vibrant-theme

Conversation

@yukazakiri
Copy link
Contributor

@yukazakiri yukazakiri commented Mar 15, 2026

Summary

This PR improves the Zed editor theme generation to actually produce readable syntax highlighting across all Material You color palettes, and also wires up the existing zed-colors.json matugen template so the iNiR-alt Dark/Light themes automatically generate alongside the main theme.

What changed in scripts/colors/zed/theme_generator.py

  • Root cause fix: When a wallpaper produces a very desaturated/greyscale Material You palette (e.g. a dark video wallpaper), the generated primary, secondary, and tertiary colors end up nearly identical shades of grey. The old code used those directly for syntax tokens, making all code look like grey-on-dark with barely any contrast.
  • Fix: Syntax colors now pull from the ANSI terminal palette (term1term6) which always has distinct hues (red, green, yellow, blue, magenta, cyan), then apply a strong saturation boost via an improved saturate() helper that includes an additive minimum-saturation floor for very muted inputs.
  • Theme blending: A configurable mix_ratio variable (currently 0.40) blends 40% of the theme's primary color into each syntax color — easy to tune, makes the whole thing feel cohesive rather than random.
  • Added missing syntax scopes that were absent in the dark theme: type, tag, string.special, method, etc.
  • Comments now render in italic style.
  • Removed the duplicate variable.special key that was silently overwriting itself.

What changed in scripts/colors/generate_terminal_configs.py

  • Added _render_zed_alt_theme() — a lightweight template renderer that resolves {{colors.*}} tokens from colors.json and material_colors.scss (covering tokens like *_fixed, surface_dim that aren't in colors.json).
  • This is needed because matugen 4.x requires a real TTY, so it can't be called from non-interactive scripts. The renderer replicates what matugen would do, without the TTY requirement.
  • Outputs to ~/.config/zed/themes/inir-alt-theme.json (iNiR-alt Dark and iNiR-alt Light) every time --zed is passed.

Also added [templates.zed_alt] to ~/.config/matugen/config.toml so it still gets picked up by matugen when called interactively (e.g. via switchwall.sh).

Motivation

The Zed theme was essentially unreadable with dark/neutral wallpapers — keywords, functions, strings and operators all blended into the background as nearly identical shades of grey. Also, the zed-colors.json matugen template existed in the repo but was never connected to anything, so users never got to try it.

Testing

  1. Set a dark or desaturated wallpaper and trigger a color update
  2. Run python3 scripts/colors/generate_terminal_configs.py --zed
  3. Open Zed and check that iNiR Dark syntax highlighting is colorful and readable
  4. Switch theme to iNiR-alt Dark or iNiR-alt Light — both should be available
  5. Tweak mix_ratio in theme_generator.py (look for the comment # Mix a percentage...) to adjust the blend strength

Checklist

  • Tested on Niri (or Hyprland if applicable)
  • Tested both ii and waffle families for UI changes
  • Tested material, aurora, and inir styles for ii changes
  • No hardcoded values (colors, fonts, durations use design tokens)
  • Config changes synced in Config.qml and defaults/config.json
  • Config access uses optional chaining: Config.options?.section?.option ?? default
  • IPC functions have explicit return types (: void, : string, etc.)
  • Shell restarted after changes: qs kill -c ii; qs -c ii
  • Logs checked for errors: qs log -c ii | tail -50
  • Lazy-loaded components tested (Settings, overlays)
  • No console errors or warnings

Related

Closes #
Fixes #

…nfigs

- Add _render_zed_alt_theme() to render dots/.config/matugen/templates/zed-colors.json
  without requiring a TTY (matugen 4.x limitation)
- Resolves all {{colors.*}} tokens from colors.json + material_colors.scss fallback
- Outputs to ~/.config/zed/themes/inir-alt-theme.json (iNiR-alt Dark/Light)
- Called automatically alongside the main Zed theme on every --zed run
Replace opaque outline borders with subtle alpha-based borders:
- border: on_surface at 12% opacity (was solid outline)
- border.variant: surface_std at 12% opacity (was darkened surface_low)
- border.selected: on_surface at 25% opacity (was primary at 70% lightness)
- border.disabled: outline_variant at 37% opacity (was darkened outline)
@yukazakiri yukazakiri changed the base branch from future to main March 15, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant