StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
feat: add light app theme
David Nashash3577a37b396f
diff --git a/core/ui/src/main/java/com/streamvault/core/ui/design/AppPalette.kt b/core/ui/src/main/java/com/streamvault/core/ui/design/AppPalette.ktindex bab5c61a..38f6fa54 100644--- a/core/ui/src/main/java/com/streamvault/core/ui/design/AppPalette.kt+++ b/core/ui/src/main/java/com/streamvault/core/ui/design/AppPalette.kt@@ -26,14 +26,17 @@ data class AppPalette(val divider: Color,val outline: Color,val heroTop: Color,- val heroBottom: Color+ val heroBottom: Color,+ val isLight: Boolean) {companion object {const val CLASSIC_BLUE_ID = "classic_blue"const val M3_PURPLE_ID = "m3_purple"+ const val LIGHT_ID = "light"fun forTheme(themeId: String?): AppPalette = when (themeId?.trim()?.lowercase()) {M3_PURPLE_ID -> m3Purple()+ LIGHT_ID -> light()else -> classicBlue()}@@ -60,7 +63,8 @@ data class AppPalette(divider = Color(0x1AF4F8FF),outline = Color(0x264C6D95),heroTop = Color(0xCC07111B),- heroBottom = Color(0xF207111B)+ heroBottom = Color(0xF207111B),+ isLight = false)fun m3Purple(): AppPalette = AppPalette(@@ -86,7 +90,35 @@ data class AppPalette(divider = Color(0x1AF4F8FF),outline = Color(0x26FFFFFF),heroTop = Color(0xCC0A0A0D),- heroBottom = Color(0xF20A0A0D)+ heroBottom = Color(0xF20A0A0D),+ isLight = false+ )++ fun light(): AppPalette = AppPalette(+ canvas = Color(0xFFF4F7FB),+ canvasElevated = Color.White,+ surface = Color.White,+ surfaceElevated = Color(0xFFEAF0F8),+ surfaceEmphasis = Color(0xFFDDE7F3),+ surfaceAccent = Color(0xFFD2E2F5),+ brand = Color(0xFF185FB4),+ brandMuted = Color(0x33185FB4),+ brandStrong = Color(0xFF0D47A1),+ onPrimary = Color.White,+ focus = Color(0xFF123B6D),+ textPrimary = Color(0xFF132033),+ textSecondary = Color(0xFF41516A),+ textTertiary = Color(0xFF667892),+ textDisabled = Color(0xFF9AA7B8),+ live = Color(0xFFB3261E),+ success = Color(0xFF176B47),+ warning = Color(0xFF8A5200),+ info = Color(0xFF006A8E),+ divider = Color(0x1F132033),+ outline = Color(0x335B6B82),+ heroTop = Color(0xCCF4F7FB),+ heroBottom = Color(0xF2F4F7FB),+ isLight = true)}}diff --git a/core/ui/src/main/java/com/streamvault/core/ui/theme/Theme.kt b/core/ui/src/main/java/com/streamvault/core/ui/theme/Theme.ktindex 6d196b90..30616abc 100644--- a/core/ui/src/main/java/com/streamvault/core/ui/theme/Theme.kt+++ b/core/ui/src/main/java/com/streamvault/core/ui/theme/Theme.kt@@ -6,6 +6,7 @@ import androidx.compose.runtime.SideEffectimport androidx.compose.ui.graphics.Colorimport androidx.tv.material3.MaterialThemeimport androidx.tv.material3.darkColorScheme+import androidx.tv.material3.lightColorSchemeimport com.streamvault.core.ui.design.AppColorsimport com.streamvault.core.ui.design.AppPaletteimport com.streamvault.core.ui.design.AppShapes@@ -28,24 +29,45 @@ fun StreamVaultTheme(LocalAppShapes provides AppShapes()) {MaterialTheme(- colorScheme = darkColorScheme(- primary = palette.brand,- onPrimary = palette.onPrimary,- secondary = palette.success,- onSecondary = Color(0xFF003320),- tertiary = palette.info,- onTertiary = Color(0xFF00344A),- surface = palette.surface,- onSurface = palette.textPrimary,- surfaceVariant = palette.surfaceElevated,- onSurfaceVariant = palette.textSecondary,- background = palette.canvasElevated,- onBackground = palette.textPrimary,- error = palette.live,- onError = palette.onPrimary,- errorContainer = palette.live.copy(alpha = 0.20f),- onErrorContainer = Color(0xFFFFDCDE)- ),+ colorScheme = if (palette.isLight) {+ lightColorScheme(+ primary = palette.brand,+ onPrimary = palette.onPrimary,+ secondary = palette.success,+ onSecondary = Color.White,+ tertiary = palette.info,+ onTertiary = Color.White,+ surface = palette.surface,+ onSurface = palette.textPrimary,+ surfaceVariant = palette.surfaceElevated,+ onSurfaceVariant = palette.textSecondary,+ background = palette.canvasElevated,+ onBackground = palette.textPrimary,+ error = palette.live,+ onError = palette.onPrimary,+ errorContainer = palette.live.copy(alpha = 0.12f),+ onErrorContainer = Color(0xFF601410)+ )+ } else {+ darkColorScheme(+ primary = palette.brand,+ onPrimary = palette.onPrimary,+ secondary = palette.success,+ onSecondary = Color(0xFF003320),+ tertiary = palette.info,+ onTertiary = Color(0xFF00344A),+ surface = palette.surface,+ onSurface = palette.textPrimary,+ surfaceVariant = palette.surfaceElevated,+ onSurfaceVariant = palette.textSecondary,+ background = palette.canvasElevated,+ onBackground = palette.textPrimary,+ error = palette.live,+ onError = palette.onPrimary,+ errorContainer = palette.live.copy(alpha = 0.20f),+ onErrorContainer = Color(0xFFFFDCDE)+ )+ },typography = typography,content = content)diff --git a/core/ui/src/test/java/com/streamvault/core/ui/design/AppPaletteTest.kt b/core/ui/src/test/java/com/streamvault/core/ui/design/AppPaletteTest.ktindex 90905c74..d3e983ce 100644--- a/core/ui/src/test/java/com/streamvault/core/ui/design/AppPaletteTest.kt+++ b/core/ui/src/test/java/com/streamvault/core/ui/design/AppPaletteTest.kt@@ -26,6 +26,17 @@ class AppPaletteTest {assertThat(palette.onPrimary).isEqualTo(Color(0xFF381E72))}+ @Test+ fun `light theme uses a light surface palette and readable dark text`() {+ val palette = AppPalette.forTheme("light")++ assertThat(palette.canvas).isEqualTo(Color(0xFFF4F7FB))+ assertThat(palette.surface).isEqualTo(Color.White)+ assertThat(palette.brand).isEqualTo(Color(0xFF185FB4))+ assertThat(palette.textPrimary).isEqualTo(Color(0xFF132033))+ assertThat(palette.isLight).isTrue()+ }+@Testfun `unknown theme IDs resolve to classic blue`() {assertThat(AppPalette.forTheme("unknown")).isEqualTo(AppPalette.forTheme("classic_blue"))diff --git a/docs/superpowers/plans/2026-09-08-multiple-themes.md b/docs/superpowers/plans/2026-09-08-multiple-themes.mdindex 11490642..88e62d0a 100644--- a/docs/superpowers/plans/2026-09-08-multiple-themes.md+++ b/docs/superpowers/plans/2026-09-08-multiple-themes.md@@ -2,7 +2,7 @@> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans (inline execution is approved for this branch). Steps use checkbox (`- [ ]`) syntax for tracking.-**Goal:** Add two selectable palette themes, persist the choice, apply it at both app entry points, expose it in Settings, and round-trip it through portable backups.+**Goal:** Add three selectable palette themes, persist the choice, apply it at both app entry points, expose it in Settings, and round-trip it through portable backups.**Architecture:** The domain defines stable theme IDs and fallback parsing. DataStore and the existing SettingsPreferences/snapshot flow carry the enum; core UI resolves the ID into a state-backed palette facade and Material TV color scheme without taking a dependency on domain. MainActivity and TvInputSetupActivity pass the persisted storage ID into StreamVaultTheme.@@ -14,6 +14,7 @@- `classic_blue` is the default and preserves the existing palette.- `m3_purple` is palette-only; typography, shapes, spacing, layout, and behavior remain shared.+- `light` uses a light Material color scheme; typography, shapes, spacing, layout, and behavior remain shared.- Invalid or missing theme values fall back to `classic_blue`.- Core UI must remain independent of `:domain`, `:data`, `:app`, and feature modules.- Portable backups must include the theme and restore it tolerantly.@@ -28,7 +29,7 @@- Test: `domain/src/test/java/com/streamvault/domain/model/AppThemeTest.kt`**Interfaces:**-- Produces `AppTheme.CLASSIC_BLUE`, `AppTheme.M3_PURPLE`, `AppTheme.DEFAULT`, `AppTheme.storageValue`, and `AppTheme.fromStorage(value: String?): AppTheme`.+- Produces `AppTheme.CLASSIC_BLUE`, `AppTheme.M3_PURPLE`, `AppTheme.LIGHT`, `AppTheme.DEFAULT`, `AppTheme.storageValue`, and `AppTheme.fromStorage(value: String?): AppTheme`.- [ ] **Step 1: Write the failing tests** for stable IDs, case-insensitive parsing, and fallback for null/unknown/blank input.- [ ] **Step 2: Run `:domain:test` for `AppThemeTest` and confirm the failure is caused by the missing model.**@@ -47,10 +48,10 @@**Interfaces:**- Produces `AppPalette.forTheme(themeId: String): AppPalette` and `StreamVaultTheme(themeId: String = "classic_blue", content: @Composable () -> Unit)`.-- [ ] **Step 1: Write failing palette tests** proving classic blue retains the current brand/surface colors, M3 purple changes the primary/surface colors, and an unknown ID resolves to classic blue.+- [ ] **Step 1: Write failing palette tests** proving classic blue retains the current brand/surface colors, M3 purple changes the primary/surface colors, light uses light surfaces/dark text, and an unknown ID resolves to classic blue.- [ ] **Step 2: Run `:core:ui:testDebugUnitTest` for the palette test and confirm the expected missing-symbol failure.**-- [ ] **Step 3: Implement the two complete palettes and state-backed `AppColors` getters.**-- [ ] **Step 4: Change top-level color aliases to computed getters and build the Material TV color scheme from the selected palette.**+- [ ] **Step 3: Implement the three complete palettes and state-backed `AppColors` getters.**+- [ ] **Step 4: Change top-level color aliases to computed getters and build the appropriate dark or light Material TV color scheme from the selected palette.**- [ ] **Step 5: Re-run the focused core UI test and `:core:ui:check` to verify both behavior and the existing module boundary.**### Task 3: Persist theme through the settings contract and DataStorediff --git a/docs/superpowers/specs/2026-09-08-multiple-themes-design.md b/docs/superpowers/specs/2026-09-08-multiple-themes-design.mdindex 4644b8eb..3e0a322d 100644--- a/docs/superpowers/specs/2026-09-08-multiple-themes-design.md+++ b/docs/superpowers/specs/2026-09-08-multiple-themes-design.md@@ -2,7 +2,7 @@## Goal-Add a user-selectable palette theme to StreamVault. The existing blue/navy palette remains the default, and the M3 purple-on-black palette becomes a second selectable theme.+Add user-selectable palette themes to StreamVault. The existing blue/navy palette remains the default, the M3 purple-on-black palette is selectable, and a true light palette is available for brighter viewing environments.## Scope@@ -22,12 +22,13 @@ Theme IDs are stable storage values, not enum ordinals:| --- | --- | --- || `classic_blue` | Classic blue | Current StreamVault blue/navy palette || `m3_purple` | M3 purple | Purple primary with neutral black surfaces |+| `light` | Light | Light surfaces with readable dark text and blue accents |## ArchitectureThe domain layer owns the stable `AppTheme` ID enum and its tolerant storage parser. The data layer exposes it through `SettingsPreferences`, stores it in DataStore, and includes it in the existing portable backup registry and backup codec. The settings feature observes and writes the enum through its existing preference snapshot/view-model flow.-The core UI layer owns the color palettes because it is intentionally independent of the domain and app modules. `StreamVaultTheme(themeId: String)` resolves the requested palette, updates the existing `AppColors` facade through Compose state, and constructs the Material TV color scheme from that palette. Existing color call sites remain source-compatible, while top-level aliases become computed getters so they follow palette changes. The app entry points collect the domain preference and pass its stable storage value to core UI.+The core UI layer owns the color palettes because it is intentionally independent of the domain and app modules. `StreamVaultTheme(themeId: String)` resolves the requested palette, updates the existing `AppColors` facade through Compose state, and constructs either a dark or light Material TV color scheme from that palette. Existing color call sites remain source-compatible, while top-level aliases become computed getters so they follow palette changes. The app entry points collect the domain preference and pass its stable storage value to core UI.## Safety and compatibilitydiff --git a/domain/src/main/java/com/streamvault/domain/model/AppTheme.kt b/domain/src/main/java/com/streamvault/domain/model/AppTheme.ktindex 030e8b2c..acae943b 100644--- a/domain/src/main/java/com/streamvault/domain/model/AppTheme.kt+++ b/domain/src/main/java/com/streamvault/domain/model/AppTheme.kt@@ -2,7 +2,8 @@ package com.streamvault.domain.modelenum class AppTheme(val storageValue: String) {CLASSIC_BLUE("classic_blue"),- M3_PURPLE("m3_purple");+ M3_PURPLE("m3_purple"),+ LIGHT("light");companion object {val DEFAULT: AppTheme = CLASSIC_BLUEdiff --git a/domain/src/test/java/com/streamvault/domain/model/AppThemeTest.kt b/domain/src/test/java/com/streamvault/domain/model/AppThemeTest.ktindex cded1335..8464a8f6 100644--- a/domain/src/test/java/com/streamvault/domain/model/AppThemeTest.kt+++ b/domain/src/test/java/com/streamvault/domain/model/AppThemeTest.kt@@ -9,15 +9,18 @@ class AppThemeTest {fun `storage values are stable and distinct`() {assertThat(AppTheme.CLASSIC_BLUE.storageValue).isEqualTo("classic_blue")assertThat(AppTheme.M3_PURPLE.storageValue).isEqualTo("m3_purple")+ assertThat(AppTheme.LIGHT.storageValue).isEqualTo("light")assertThat(AppTheme.entries.map(AppTheme::storageValue)).containsExactly("classic_blue",- "m3_purple"+ "m3_purple",+ "light").inOrder()}@Testfun `fromStorage accepts case and surrounding whitespace`() {assertThat(AppTheme.fromStorage(" M3_PURPLE ")).isEqualTo(AppTheme.M3_PURPLE)+ assertThat(AppTheme.fromStorage(" LIGHT ")).isEqualTo(AppTheme.LIGHT)}@Testdiff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsBrowsingSection.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsBrowsingSection.ktindex 2b8886fb..cffaa783 100644--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsBrowsingSection.kt+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsBrowsingSection.kt@@ -594,4 +594,5 @@ private fun RemoteColorButton.accentColor(): Color = when (this) {private fun AppTheme.labelResId(): Int = when (this) {AppTheme.CLASSIC_BLUE -> R.string.settings_theme_classic_blueAppTheme.M3_PURPLE -> R.string.settings_theme_m3_purple+ AppTheme.LIGHT -> R.string.settings_theme_light}diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceDialogs.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceDialogs.ktindex 1e1c8ffa..94f59dce 100644--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceDialogs.kt+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceDialogs.kt@@ -400,4 +400,5 @@ private fun AppLandingDestination.labelResId(): Int = when (this) {private fun AppTheme.labelResId(): Int = when (this) {AppTheme.CLASSIC_BLUE -> R.string.settings_theme_classic_blueAppTheme.M3_PURPLE -> R.string.settings_theme_m3_purple+ AppTheme.LIGHT -> R.string.settings_theme_light}diff --git a/feature/settings/src/main/res/values/strings.xml b/feature/settings/src/main/res/values/strings.xmlindex 5485f404..37e391e2 100644--- a/feature/settings/src/main/res/values/strings.xml+++ b/feature/settings/src/main/res/values/strings.xml@@ -43,6 +43,7 @@<string name="settings_select_theme">Select theme</string><string name="settings_theme_classic_blue">Classic blue</string><string name="settings_theme_m3_purple">M3 purple</string>+ <string name="settings_theme_light">Light</string><string name="settings_live_channel_numbering_mode">Live TV Channel Numbering</string><string name="settings_live_channel_numbering_mode_subtitle">Choose whether live channels use their position in the current group or keep the original numbers from the provider.</string><string name="settings_live_channel_numbering_group">Per Group</string>