Skip to content

chat: adopt lui scoped theme API for semantic colors - #23

Merged
tiensonqin merged 4 commits into
mainfrom
devin/1790319207-theme-api
Sep 25, 2026
Merged

tiensonqin merged 4 commits into
mainfrom
devin/1790319207-theme-api

Conversation

@tiensonqin

Copy link
Copy Markdown
Contributor

Summary

Adopts the new LUI scoped theme API (logseq/lui#49) so the chat palette comes from the wire instead of a host-side color dictionary.

  • View.chat_view now wraps the screen tree in Lui_elements.themed ~tokens:chat_theme_tokens ~mode_signal:(Signal.map chat_theme_mode model_source). chat_theme_tokens carries the LogseqThemePolicy palette: mode-dependent colors (background, surface, autocomplete-row-background) use the new adaptive {light,dark} token form picked per backend effective color scheme, while task/flashcard colors are Fixed hex+alpha strings converted 1:1 from the previous Color(...)/opacity(0.12) literals.
  • chat_theme_mode maps model.appearance ("system"|"light"|"dark") to a theme_mode signal, so the appearance setting hot-switches every backend's effective scheme with one patch — previously this only reached the native shell.
  • LogseqChatRootView: drops the .luiSemanticColors([...]) dictionary; the SwiftUI palette stays for app chrome (.tint, .foregroundStyle, .background) outside the LUI tree. Flutter keeps LogseqChatTheme/themeMode as platform shell theme for the same reason.
  • Bumps the three lui pins to the theme commit 5958c0c (opam pin, SPM revision, pubspec ref).

Verified: dune build @shared/native/runtest — 716/716 pass.

Link to Devin session: https://app.devin.ai/sessions/eab2eca00a5649d09fcf48626d9f09ef
Open in Devin Desktop: https://app.devin.ai/desktop/session/eab2eca00a5649d09fcf48626d9f09ef?variant=devin
Requested by: @tiensonqin

Replace the host-side .luiSemanticColors dictionary with wire-level
theme tokens emitted by the OCaml view: mode-dependent colors ride as
adaptive {light,dark} pairs and theme-mode follows the appearance
setting, so light/dark switching and palette overrides now come from
one OCaml declaration on every backend.

Bumps the lui pins (opam, SPM, pubspec) to the theme API commit.
@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration

Copy link
Copy Markdown

E2E-tested on iPhone 17 Pro sim (iOS 26.5) — built this branch (lui pins at 5958c0cd), Cognito sign-in, sync graph over local db-sync, seeded flashcards, pixel-sampled rendered colors. Results are mixed: core theming works, but presented content loses the scoped theme env.

✅ In-tree theming fully works — dark flashcards shows exact #002D38 page bg, themed surface card (#F8F8F8/#19394D), and flashcard-* tinted rating buttons:

dark flashcards themed

✅ Appearance switch works live both directions (Light↔Dark↔System, no restart; teal #002D38 renders while device stays light — pixel-verified).

❌ .sheet content loses luiSemanticColors — settings sheet renders secondarySystemGroupedBackground #1C1C1E instead of #002D38/#19394D (cards request ~background:"surface"). Likely cause: .sheet is attached at LUISwiftUIRoot.rootContent outside the LUIThemeScopeModifier env scope (LUISwiftUIRoot.swift:91 vs :542); removing the host-root .luiSemanticColors dict broke what previously reached sheets. Add-graph sheet is also unthemed (#F2F2F8).

dark settings sheet unthemed

❌ task-* tokens have no visible consumer on iOS — the composer status picker renders icon-free pills with uniform accent text (the only task-* consumer on Apple is the picker menu-item icon foreground, view_composer.ml:184; icons don't render in this dropdown presentation):

task picker uniform blue

Full check results + more screenshots
  • Light bg ≈#FCFCFC, dark bg exact #002D38; System mode follows device (simctl ui appearance). ChangeAppearance also persists logseq.appearance which drives the native root .preferredColorScheme, so the flip isn't isolated to the wire theme-mode patch — but themed colors prove the theme tokens apply.
  • Add-graph sheet unthemed (#F2F2F8): add graph sheet
  • Light flashcard tints + surface card: light flashcards
  • Dark graph picker after choosing Dark (device stays light): dark picker
  • Screen recording and pixel-sample data available in the Devin session.

@tiensonqin
tiensonqin merged commit 85e2b3e into main Sep 25, 2026
3 checks passed
@tiensonqin
tiensonqin deleted the devin/1790319207-theme-api branch September 26, 2026 14:30
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