Skip to content

feat(native): close AP-THEME and advance ST-APPEARANCE parity - #433

Merged
rynfar merged 1 commit into
nativefrom
nw/f5-appearance-theme
Nov 19, 2026
Merged

rynfar merged 1 commit into
nativefrom
nw/f5-appearance-theme

Conversation

@rynfar

@rynfar rynfar commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Closes #252
Refs #1, #391

Problem

AP-THEME and ST-APPEARANCE were missing upstream web parity from pingdotgg/t3code#35247 and pingdotgg/t3code#36042, plus the Render math toggle in Appearance settings:

  1. Theme definitions, import/export, editor sessions, and live palettes did not support agent-editable theme css, remote-fetch sanitization, or ThemeCssEditor.
  2. Server-driven defaultTheme/defaultThemeSetAt and defaultAppearance/defaultAppearanceSetAt generation tracking (useDefaultTheme.ts) was not implemented or wired to ServerConfig updates.
  3. Cold launch initialized ThemeState with defaults before reading saved preferences and had no cached t3code:environment-themes:v1 fallback, causing a stock-palette flash until the server replied.
  4. mathRenderingEnabled was wired in markdown/preview rendering and ClientSettingsDoc but had no UI toggle in settings/appearance.rs.

Approach

  • Theme CSS engine & ThemeCssEditor (pingdotgg/t3code#35247):
    • Added crates/core/src/themes/css.rs porting themeCssValueFetches, themeCssLoadsRemoteFiles, CSS custom-property cascade parsing (:root, .dark, :not(.dark), [data-app-sidebar], !important, var(...)), --app-theme-* role & semantic token overrides, and ThemeCssEditor Tab/Shift+Tab/Enter indentation & cursor Ln/Col helpers.
    • Added css: Option<String> to ThemeDefinition with MAX_CSS_LEN (20_000 UTF-16 units) validation, export/import/rename preservation, legacy built-in alias resolution (t3-grove, t3-chat-dark, etc.), and palette_for_with_css.
    • Extended crates/core/src/themes/editor.rs and crates/app/src/theme_editor.rs with collapsible Custom CSS editing, live custom-property preview (restored on cancel/close), merge CSS inheritance & conflict validation, remote-fetch/length diagnostics, and Escape panel dismissal.
  • Default theme & appearance adoption + cached environment themes (pingdotgg/t3code#35247, pingdotgg/t3code#36042):
    • Added crates/core/src/themes/default_sync.rs porting useDefaultTheme.ts generation tracking (t3code:default-theme-applied:v2:<envId>, t3code:default-appearance-applied:v1:<envId>, single-appearance auto-mode, late-resolution retry) and t3code:environment-themes:v1 persistence helpers.
    • Wired crates/app/src/sidebar/controller.rs (sync_server_config) to keep cached environment themes before environment_themes_received, persist live published themes (including explicit empty clears), and adopt defaultTheme/defaultAppearance once per generation.
  • First-frame theme paint parity (pingdotgg/t3code#36042):
    • Added theme::init_from_doc / theme::boot_saved in crates/app/src/theme/mod.rs and invoked theme::boot_saved(cx) in crates/app/src/main.rs before window creation so saved preferences, custom themes, cached environment themes, and CSS custom properties paint from frame 1.
  • Appearance settings (ST-APPEARANCE):
    • Added the Render math (mathRenderingEnabled) switch and reset action to crates/app/src/settings/appearance.rs.

Ledger Updates (apps/native/parity/LEDGER.md)

  • AP-THEME: partial (#1, #252) → done (blank Issue). Arbitrary CSS DOM selectors & DOM getComputedStyle inspector/usage highlights are documented as [D]/DOM n/a in GPUI.
  • ST-APPEARANCE: updated Native summary; honestly kept partial (#1) for remaining AppearanceSettingsPanel.tsx Interface rows (ThreadDetailsItemsRow, effortDisplay, panelAnimationDurationMs, environmentIdentificationMode, persistComposerContextStrip) outside this slice's ownership.

Verification

  • cargo clippy --workspace --all-targets -- -D warnings: pass (0 warnings)
  • cargo test -p t3-core themes -- --test-threads=1: 60/60 pass
  • cargo test -p t3-core --test conformance -- --test-threads=1: 8/8 pass
  • cargo test -p t3-client -- --test-threads=1: 151/151 pass
  • T3_NATIVE_HOME=$(mktemp -d) cargo test -p t3-native --features snapshot theme -- --test-threads=1: 11/11 pass
  • T3_NATIVE_HOME=$(mktemp -d) cargo test -p t3-native --features snapshot sync_server_config_preserves_cached_themes -- --test-threads=1: 1/1 pass
  • cargo build -p t3-native: pass
  • vp fmt --check apps/native/parity/LEDGER.md: pass
  • node apps/native/scripts/gen-theme.ts --check: pass
  • node --test apps/native/parity/sync.test.ts: 47/47 pass

Built with Antigravity (f5-appearance-theme).

@rynfar
rynfar merged commit f57a42b into native Nov 19, 2026
2 checks passed
@rynfar
rynfar deleted the nw/f5-appearance-theme branch November 19, 2026 16:59
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