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
- Bump the pin.
- Delete vimcode's
Color type; use quadraui::Color throughout. This removes ~76 conversion call sites.
- Delete
from_vscode_json, strip_json_comments and the theme-directory helpers; call the upstream loader.
- 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.
Problem
src/render.rscarries its ownColortype and a complete VS Code theme loader, then pays to convert both into quadraui's equivalents on every use.Color(incl.from_hex,lighten,darken)src/render.rs:29-230Theme::from_vscode_jsonsrc/render.rs:12384-12735strip_json_commentssrc/render.rs:181-229load_vscode_theme/themes_dir/available_namessrc/render.rs:12313-12383Themestruct +implsrc/render.rs:11162-12848quadraui already ships
theme.rs(563 lines, 60+ chrome fields) andtypes::Colorwith the samefrom_hex/lighten/darken. The cost of the duplicate type is paid at 62 conversion call sites inrender.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) andColor::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)andColor::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
Colortype; usequadraui::Colorthroughout. This removes ~76 conversion call sites.from_vscode_json,strip_json_commentsand the theme-directory helpers; call the upstream loader.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
feedback_no_hardcoded_colors, no hex/RGB literal may appear in rendering code — everything reads from the theme struct.develop.