package tv.tivilux.nativeplayer.ui.theme import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.MaterialTheme import androidx.compose.material3.darkColorScheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import tv.tivilux.nativeplayer.model.AppSettings import androidx.compose.ui.graphics.Color var LuxBg by mutableStateOf(Color(0xFF090B10)) var LuxPanel by mutableStateOf(Color(0xFF13161D)) var LuxPanel2 by mutableStateOf(Color(0xFF1B2029)) var LuxText by mutableStateOf(Color(0xFFF5F3EF)) var LuxMuted by mutableStateOf(Color(0xFF9BA2AD)) var LuxGold by mutableStateOf(Color(0xFFE8C38B)) var LuxGoldBright by mutableStateOf(Color(0xFFF3D6AB)) val LuxGreen = Color(0xFF78D69B) val LuxDanger = Color(0xFFB45C65) var LuxLine by mutableStateOf(Color(0x1FFFFFFF)) private fun scheme() = darkColorScheme( primary = LuxGold, onPrimary = Color(0xFF191714), secondary = LuxGoldBright, background = LuxBg, onBackground = LuxText, surface = LuxPanel, onSurface = LuxText, surfaceVariant = LuxPanel2, onSurfaceVariant = LuxMuted, error = LuxDanger, ) @Composable fun TiviLuxTheme(content: @Composable () -> Unit) { MaterialTheme( colorScheme = scheme(), content = content, ) } val TiviLuxThemeNames = listOf("Original Gold", "Netflix Style", "Monochrome", "Pink Luxe", "Cotton Candy", "Halloween", "Christmas", "Custom") /** Set only presentation colors; never touch playback or guide state. */ fun applyTiviLuxPalette(settings: AppSettings) { fun hex(value: String, fallback: Color): Color = try { val digits = value.removePrefix("#") if (digits.length != 6) fallback else Color(android.graphics.Color.parseColor("#" + digits)) } catch (_: Exception) { fallback } val (bg, panel, accent, focus) = when (settings.colorTheme) { "Netflix Style" -> listOf(0xFF080A0E, 0xFF171C24, 0xFFD52235, 0xFFFF6370) "Monochrome" -> listOf(0xFF101318, 0xFF232B35, 0xFFE3E9F1, 0xFFFFFFFF) "Pink Luxe" -> listOf(0xFF110F17, 0xFF28202C, 0xFFDDA8B8, 0xFFFFD7DF) "Cotton Candy" -> listOf(0xFF111829, 0xFF222D43, 0xFF82D9D2, 0xFFF6A9D0) "Halloween" -> listOf(0xFF0E1014, 0xFF26202A, 0xFFE8873A, 0xFFFFC67D) "Christmas" -> listOf(0xFF0D1717, 0xFF1B302D, 0xFFCBA96D, 0xFFF0D5A0) "Custom" -> { LuxBg = hex(settings.customBackground, Color(0xFF090B10)) LuxPanel = LuxBg.copy(red = (LuxBg.red + .06f).coerceAtMost(1f), green = (LuxBg.green + .06f).coerceAtMost(1f), blue = (LuxBg.blue + .06f).coerceAtMost(1f)) LuxPanel2 = LuxPanel LuxGold = hex(settings.customAccent, Color(0xFFE8C38B)) LuxGoldBright = hex(settings.customFocus, Color(0xFFF3D6AB)) LuxText = if (LuxBg.red * .2126f + LuxBg.green * .7152f + LuxBg.blue * .0722f > .48f) Color(0xFF121212) else Color.White LuxMuted = LuxText.copy(alpha = .7f) return } else -> listOf(0xFF090B10, 0xFF13161D, 0xFFE8C38B, 0xFFF3D6AB) } LuxBg = Color(bg); LuxPanel = Color(panel); LuxPanel2 = Color(panel).copy(alpha = .94f) LuxGold = Color(accent); LuxGoldBright = Color(focus) LuxText = Color.White; LuxMuted = Color(0xFFABB0BA) } /** Allows the Guide quick-settings shortcut to open the Theme Studio section. */ object ThemeStudioNavigation { var openOnNextSettings by mutableStateOf(false) }