diff --git a/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/FixedAccentColors.kt b/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/FixedAccentColors.kt new file mode 100644 index 000000000..fd9f3b44f --- /dev/null +++ b/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/FixedAccentColors.kt @@ -0,0 +1,88 @@ +package io.github.droidkaigi.confsched.designsystem.theme + +import androidx.compose.material3.ColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.ReadOnlyComposable +import androidx.compose.runtime.compositionLocalOf +import androidx.compose.ui.graphics.Color + +data class FixedAccentColors( + val primaryFixed: Color, + val onPrimaryFixed: Color, + val secondaryFixed: Color, + val onSecondaryFixed: Color, + val tertiaryFixed: Color, + val onTertiaryFixed: Color, + val primaryFixedDim: Color, + val secondaryFixedDim: Color, + val tertiaryFixedDim: Color, +) + +@Suppress("CompositionLocalAllowlist") +internal val LocalFixedAccentColors = compositionLocalOf { + FixedAccentColors( + primaryFixed = darkScheme.primaryContainer, + onPrimaryFixed = darkScheme.onPrimaryContainer, + secondaryFixed = darkScheme.secondaryContainer, + onSecondaryFixed = darkScheme.onSecondaryContainer, + tertiaryFixed = darkScheme.tertiaryContainer, + onTertiaryFixed = darkScheme.onTertiaryContainer, + primaryFixedDim = darkScheme.primary, + secondaryFixedDim = darkScheme.secondary, + tertiaryFixedDim = darkScheme.tertiary, + ) +} + +@Suppress("UnusedReceiverParameter") +val ColorScheme.primaryFixed: Color + @Composable + @ReadOnlyComposable + get() = LocalFixedAccentColors.current.primaryFixed + +@Suppress("UnusedReceiverParameter") +val ColorScheme.onPrimaryFixed: Color + @Composable + @ReadOnlyComposable + get() = LocalFixedAccentColors.current.onPrimaryFixed + +@Suppress("UnusedReceiverParameter") +val ColorScheme.secondaryFixed: Color + @Composable + @ReadOnlyComposable + get() = LocalFixedAccentColors.current.secondaryFixed + +@Suppress("UnusedReceiverParameter") +val ColorScheme.onSecondaryFixed: Color + @Composable + @ReadOnlyComposable + get() = LocalFixedAccentColors.current.onSecondaryFixed + +@Suppress("UnusedReceiverParameter") +val ColorScheme.tertiaryFixed: Color + @Composable + @ReadOnlyComposable + get() = LocalFixedAccentColors.current.tertiaryFixed + +@Suppress("UnusedReceiverParameter") +val ColorScheme.onTertiaryFixed: Color + @Composable + @ReadOnlyComposable + get() = LocalFixedAccentColors.current.onTertiaryFixed + +@Suppress("UnusedReceiverParameter") +val ColorScheme.primaryFixedDim: Color + @Composable + @ReadOnlyComposable + get() = LocalFixedAccentColors.current.primaryFixedDim + +@Suppress("UnusedReceiverParameter") +val ColorScheme.secondaryFixedDim: Color + @Composable + @ReadOnlyComposable + get() = LocalFixedAccentColors.current.secondaryFixedDim + +@Suppress("UnusedReceiverParameter") +val ColorScheme.tertiaryFixedDim: Color + @Composable + @ReadOnlyComposable + get() = LocalFixedAccentColors.current.tertiaryFixedDim diff --git a/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Theme.kt b/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Theme.kt index ca9f0ad95..b5082f359 100644 --- a/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Theme.kt +++ b/core/designsystem/src/commonMain/kotlin/io/github/droidkaigi/confsched/designsystem/theme/Theme.kt @@ -6,6 +6,8 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.darkColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.ui.graphics.Color private val lightScheme = lightColorScheme( primary = primaryLight, @@ -45,7 +47,7 @@ private val lightScheme = lightColorScheme( surfaceContainerHighest = surfaceContainerHighestLight, ) -private val darkScheme = darkColorScheme( +internal val darkScheme = darkColorScheme( primary = primaryDark, onPrimary = onPrimaryDark, primaryContainer = primaryContainerDark, @@ -235,16 +237,32 @@ private val highContrastDarkColorScheme = darkColorScheme( surfaceContainerHighest = surfaceContainerHighestDarkHighContrast, ) +private val fixedAccentColors = FixedAccentColors( + primaryFixed = Color(0xFF67FF8D), + onPrimaryFixed = Color(0xFF002109), + secondaryFixed = Color(0xFFA3F5AD), + onSecondaryFixed = Color(0xFF002109), + tertiaryFixed = Color(0xFFFFD7F0), + onTertiaryFixed = Color(0xFF3A0032), + primaryFixedDim = Color(0xFF1CE46B), + secondaryFixedDim = Color(0xFF88D893), + tertiaryFixedDim = Color(0xFFFFACE7), +) + @Composable fun KaigiTheme( - content: - @Composable () -> Unit, + content: @Composable () -> Unit, ) { val colorScheme = darkScheme MaterialTheme( colorScheme = colorScheme, typography = appTypography(), - content = content, + content = { + CompositionLocalProvider( + value = LocalFixedAccentColors provides fixedAccentColors, + content = content, + ) + }, ) }