Skip to content

Adopt quadraui Theme/Color and delete vimcode's VS Code theme loader (~650 lines) #829

Description

@JDonaghy

Problem

src/render.rs carries its own Color type and a complete VS Code theme loader, then pays to convert both into quadraui's equivalents on every use.

Component Location Lines
vimcode's Color (incl. from_hex, lighten, darken) src/render.rs:29-230 202
Theme::from_vscode_json src/render.rs:12384-12735 ~352
strip_json_comments src/render.rs:181-229 ~49
load_vscode_theme / themes_dir / available_names src/render.rs:12313-12383 ~70
Theme struct + impl src/render.rs:11162-12848 1,689 (incl. ~940 of preset hex)

quadraui already ships theme.rs (563 lines, 60+ chrome fields) and types::Color with the same from_hex / lighten / darken. The cost of the duplicate type is paid at 62 conversion call sites in render.rs (to_q_color / to_quadraui_color / to_quadraui_theme* at :19675-19777) plus 14 more in the backends.

Two of those conversions are also dead and toolkit-named: Color::to_cairo (:146) and Color::to_pango_u16 (:172) have zero callers — their deletion is covered by the dead-code sweep issue in this chain, not here.

Blocked on quadraui#775

The loader and colour maths are generic and belong upstream; the gap is filed as quadraui#775, requesting Theme::from_vscode_json(path) and Color::try_from_hex_over(hex, bg).

This issue stays open behind quadraui#775 and is deliberately NOT queued. Per GOALS.md's milestone-discipline rule, a supply-blocked #7 issue stays open behind its blocker rather than being closed.

Fix, once quadraui#775 lands

  1. Bump the pin.
  2. Delete vimcode's Color type; use quadraui::Color throughout. This removes ~76 conversion call sites.
  3. Delete from_vscode_json, strip_json_comments and the theme-directory helpers; call the upstream loader.
  4. Keep vimcode's syntax-scope fields (scope_color, semantic_token_style) and the preset syntax colours — those are editor-specific and correctly local.

Expected reduction: ~650 lines plus the conversion sites.

Acceptance

  • Black-box tests, both backends: load each bundled preset and a VS Code JSON theme, assert rendered chrome colours match before and after.
  • Per feedback_no_hardcoded_colors, no hex/RGB literal may appear in rendering code — everything reads from the theme struct.
  • State in the PR that the new tests fail against unfixed develop.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coordTracked by coord-tui pipelineplatformPlatform-specific (macOS, Windows, Linux)status:readyRefined and ready to enter the work pipeline

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions