Files
simplex-chat/apps
another-simple-pixel d947050f31 refactor: extract repeated theme/color resolution patterns
Three duplicated patterns surfaced by the audit, each consolidated into
a single named helper.

1. ThemeOverrides.toColors and toAppColors had the same five-source
   priority chain (per-chat → per-user → own → preset → base) inlined
   for nine non-bubble fields. Move it into resolveColor so each call
   site states the data, not the resolution rule. (Bubble fields keep
   their wallpaper-aware logic — different rule, separate concern.)

2. The chat's effective theme — chatInfo.uiThemes.preferredMode resolved
   through ThemeManager.currentColors — was computed inline in ChatView
   (for SimpleXThemeOverride) and again in App.ActiveChatThemeProvider
   (for the chatlist column / Android modal stack). Pull both into a
   shared rememberActiveChatTheme. Both call sites also adopt the wider
   remember key (whole theme, not just base) that the toolbar fix
   already needed; behavior is unchanged when the chat has no override.

3. The toolbar code-output copy in Appearance reimplemented oklch
   conversion inline (Color → Oklab → atan2 → degrees) instead of
   calling the existing Color.toOklch() extension. Replace with the
   extension, which also adds a small near-zero-chroma guard the inline
   version was missing.

Pure refactor — no user-visible behavior change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-13 13:45:42 -07:00
..
2025-07-08 12:22:57 +01:00