Skip to content

Commit 762f4c5

Browse files
ericmigiclaude
andcommitted
Dark mode
Compose's MyApplicationTheme already had a DarkColorScheme defined and defaults to isSystemInDarkTheme(), but the activity-level XML theme was hardcoded to android:Theme.Material.Light.NoActionBar — so cold-start window background and the splash screen flashed bright cream regardless of the system setting, then snapped to dark when Compose drew its first frame. - values/themes.xml: parameterise windowBackground via a color resource rather than the hardcoded Light theme default. - values/colors.xml: add window_background = #FFFBF0 (the cream we use in light mode). - values-night/themes.xml: dark-variant of Theme.MyApplication parented on android:Theme.Material.NoActionBar. - values-night/colors.xml: window_background and splash_background both switch to #14110A — same deep warm-black as the Compose dark scheme background, so the splash → app handoff is seamless. Verified on the emulator with `cmd uimode night yes`: list, formatted view, and the WYSIWYG editor all switch cleanly to dark, with all formatting (heading sizes, inline B/I/U/S, tables, images, link colors, checkbox states) still legible and on-brand. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7ae7c85 commit 762f4c5

4 files changed

Lines changed: 25 additions & 1 deletion

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- Splash backdrop in dark mode — match the deep warm background of the
4+
Compose dark color scheme so the splash → app handoff is seamless. -->
5+
<color name="splash_background">#14110A</color>
6+
<color name="window_background">#14110A</color>
7+
</resources>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<!-- Splash inherits the same Theme.SplashScreen parent; the night-mode
5+
color resources (windowSplashScreenBackground, window_background,
6+
etc.) are picked up automatically via the values-night/colors.xml
7+
overrides — no separate splash style needed. -->
8+
9+
<style name="Theme.MyApplication" parent="android:Theme.Material.NoActionBar">
10+
<item name="android:windowBackground">@color/window_background</item>
11+
</style>
12+
</resources>

app/src/main/res/values/colors.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
<resources>
33
<!-- Cream background that matches the launcher icon's notepad. -->
44
<color name="splash_background">#FFF8E5</color>
5+
<!-- Activity window background — also used as the cold-start backdrop
6+
before Compose paints. values-night overrides for dark mode. -->
7+
<color name="window_background">#FFFBF0</color>
58
</resources>

app/src/main/res/values/themes.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
<item name="postSplashScreenTheme">@style/Theme.MyApplication</item>
99
</style>
1010

11-
<style name="Theme.MyApplication" parent="android:Theme.Material.Light.NoActionBar" />
11+
<style name="Theme.MyApplication" parent="android:Theme.Material.Light.NoActionBar">
12+
<item name="android:windowBackground">@color/window_background</item>
13+
</style>
1214
</resources>

0 commit comments

Comments
 (0)