lattice_host/ui/theme.rs
1//! The host `Theme` + its `SyntaxStyle → visual style` mapping.
2//!
3//! The renderer-neutral *primitives* — `Color`, `Style`,
4//! `Modifiers`, `NamedColor`, the rich-vocabulary attribute types,
5//! and `parse_color` — live in the leaf crate `lattice-theme` and
6//! are **re-exported here** so every existing `lattice_host::ui::theme`
7//! / `host_theme` call site is unchanged (T.1, theme-system slice
8//! plan). Renderer crates (`lattice-ui-tui`, `lattice-ui-gpui`) ship
9//! adapters that convert these into their native style types
10//! (ratatui `Style` / `Color`, GPUI `Hsla` + per-run font shaping);
11//! the host owns the canonical theme, each renderer maintains a
12//! cached adapted view for hot-path reads.
13//!
14//! The `SyntaxStyle → visual style` bridge (`resolve_syntax_style` /
15//! `syntax_element_id`) moved DOWN to `lattice-syntax` at DX.2 (BC.6
16//! diff extraction) and is re-exported here unchanged — see the
17//! re-export note below. The element registry + palette + resolution
18//! (`lattice-theme` T.2/T.3) subsume the old flat struct; renderers read
19//! the resolved table via `ResolvedTheme` + `BuiltinElementIds`. See
20//! `docs/dev/architecture/theme-system.md`.
21
22pub use lattice_theme::{
23 BuiltinElementIds, Color, ColorRef, ElementId, ElementInfo, ElementName, ElementOwner,
24 FamilyId, FontScale, InMemoryThemeRegistry, Modifiers, NamedColor, NamedTheme, ResolvedTheme,
25 Style, StyleSpec, ThemeRegistry, ThemeRegistryHandle, Weight, builtin_themes, parse_color,
26};
27
28// DX.2 (BC.6 diff extraction): the syntax->theme-element style bridge
29// (`resolve_syntax_style` / `syntax_element_id`) moved DOWN to
30// `lattice-syntax` (`lattice_syntax::theme_style`). The bridge is
31// syntax-aware (it takes a `lattice_syntax::Style`), so it belongs in the
32// higher crate depending onto the `lattice-theme` leaf — keeping
33// `lattice-theme` a minimal renderer-hot-path leaf — and so `lattice-diff`
34// (the diff overlay) can reach it without the host. Re-exported here so
35// every existing `lattice_host::ui::theme::` / `crate::ui::theme::` call
36// site (cell builder, both renderers, the diff overlay) is unchanged; the
37// overlay's import flips to `lattice_syntax::resolve_syntax_style` when it
38// moves into `lattice-diff` at DX.6. Tests for the bridge moved with it.
39pub use lattice_syntax::{resolve_syntax_style, syntax_element_id};
40
41// T.6.t (2026-06-18): the host `Theme` struct is DELETED. All STYLE
42// fields moved to the element / resolved-table system (T.4/T.5); the
43// final 8 non-style fields (`dim_inactive_panes`,
44// `pane_separator_{vertical,horizontal}`, `nerd_fonts`, the four
45// `diagnostic_*_glyph` chars) migrated to `ui.*` typed options in
46// `crate::ui::theme_options`. Renderers read the style table via
47// `ResolvedTheme` + `BuiltinElementIds`, and the non-style flags/chars
48// via the typed-options registry. The cell-matrix invalidation key
49// (`MatrixVersion::theme`) is now `ResolvedTheme::version()`, not a
50// content-hash of this struct. See `docs/dev/architecture/theme-system.md`.