From 78512df33b9ebfb354509af7c4ff07f0126d7fa3 Mon Sep 17 00:00:00 2001 From: cooltey Date: Thu, 9 Jan 2025 17:33:21 -0800 Subject: [PATCH] Follow up: Compose color styles --- .../ComposeColors.kt} | 4 +- .../org/wikipedia/compose/WikipediaColor.kt | 117 ------------------ .../wikipedia/compose/theme/WikipediaColor.kt | 117 ++++++++++++++++++ .../compose/{ => theme}/WikipediaTheme.kt | 4 +- 4 files changed, 121 insertions(+), 121 deletions(-) rename app/src/main/java/org/wikipedia/{theme/ThemeColors.kt => compose/ComposeColors.kt} (96%) delete mode 100644 app/src/main/java/org/wikipedia/compose/WikipediaColor.kt create mode 100644 app/src/main/java/org/wikipedia/compose/theme/WikipediaColor.kt rename app/src/main/java/org/wikipedia/compose/{ => theme}/WikipediaTheme.kt (94%) diff --git a/app/src/main/java/org/wikipedia/theme/ThemeColors.kt b/app/src/main/java/org/wikipedia/compose/ComposeColors.kt similarity index 96% rename from app/src/main/java/org/wikipedia/theme/ThemeColors.kt rename to app/src/main/java/org/wikipedia/compose/ComposeColors.kt index 3f193ab7a4b..1699405b1b4 100644 --- a/app/src/main/java/org/wikipedia/theme/ThemeColors.kt +++ b/app/src/main/java/org/wikipedia/compose/ComposeColors.kt @@ -1,8 +1,8 @@ -package org.wikipedia.theme +package org.wikipedia.compose import androidx.compose.ui.graphics.Color -object ThemeColors { +object ComposeColors { val White = Color(0xFFFFFFFF) val Black = Color(0xFF000000) diff --git a/app/src/main/java/org/wikipedia/compose/WikipediaColor.kt b/app/src/main/java/org/wikipedia/compose/WikipediaColor.kt deleted file mode 100644 index 143e7e39e7f..00000000000 --- a/app/src/main/java/org/wikipedia/compose/WikipediaColor.kt +++ /dev/null @@ -1,117 +0,0 @@ -package org.wikipedia.compose - -import androidx.compose.runtime.Immutable -import androidx.compose.runtime.staticCompositionLocalOf -import androidx.compose.ui.graphics.Color -import org.wikipedia.theme.ThemeColors - -@Immutable -data class WikipediaColor( - val primaryColor: Color, - val paperColor: Color, - val backgroundColor: Color, - val inactiveColor: Color, - val placeholderColor: Color, - val secondaryColor: Color, - val borderColor: Color, - val progressiveColor: Color, - val successColor: Color, - val destructiveColor: Color, - val warningColor: Color, - val highlightColor: Color, - val focusColor: Color, - val additionColor: Color, - val overlayColor: Color -) - -val LocalWikipediaColor = staticCompositionLocalOf { - WikipediaColor( - primaryColor = Color.Unspecified, - paperColor = Color.Unspecified, - backgroundColor = Color.Unspecified, - inactiveColor = Color.Unspecified, - placeholderColor = Color.Unspecified, - secondaryColor = Color.Unspecified, - borderColor = Color.Unspecified, - progressiveColor = Color.Unspecified, - successColor = Color.Unspecified, - destructiveColor = Color.Unspecified, - warningColor = Color.Unspecified, - highlightColor = Color.Unspecified, - focusColor = Color.Unspecified, - additionColor = Color.Unspecified, - overlayColor = Color.Unspecified, - ) -} - -val LightColors = WikipediaColor( - primaryColor = ThemeColors.Gray700, - paperColor = ThemeColors.White, - backgroundColor = ThemeColors.Gray100, - inactiveColor = ThemeColors.Gray400, - placeholderColor = ThemeColors.Gray500, - secondaryColor = ThemeColors.Gray600, - borderColor = ThemeColors.Gray200, - progressiveColor = ThemeColors.Blue600, - successColor = ThemeColors.Green700, - destructiveColor = ThemeColors.Red700, - warningColor = ThemeColors.Yellow700, - highlightColor = ThemeColors.Yellow500, - focusColor = ThemeColors.Orange500, - additionColor = ThemeColors.Blue300_15, - overlayColor = ThemeColors.Black_30 -) - -val DarkColors = WikipediaColor( - primaryColor = ThemeColors.Gray200, - paperColor = ThemeColors.Gray700, - backgroundColor = ThemeColors.Gray675, - inactiveColor = ThemeColors.Gray500, - placeholderColor = ThemeColors.Gray400, - secondaryColor = ThemeColors.Gray300, - borderColor = ThemeColors.Gray650, - progressiveColor = ThemeColors.Blue300, - successColor = ThemeColors.Green600, - destructiveColor = ThemeColors.Red500, - warningColor = ThemeColors.Orange500, - highlightColor = ThemeColors.Yellow500_40, - focusColor = ThemeColors.Orange500_50, - additionColor = ThemeColors.Blue600_30, - overlayColor = ThemeColors.Black_70 -) - -val BlackColors = WikipediaColor( - primaryColor = ThemeColors.Gray200, - paperColor = ThemeColors.Black, - backgroundColor = ThemeColors.Gray700, - inactiveColor = ThemeColors.Gray500, - placeholderColor = ThemeColors.Gray500, - secondaryColor = ThemeColors.Gray300, - borderColor = ThemeColors.Gray675, - progressiveColor = ThemeColors.Blue300, - successColor = ThemeColors.Green600, - destructiveColor = ThemeColors.Red500, - warningColor = ThemeColors.Orange500, - highlightColor = ThemeColors.Yellow500_40, - focusColor = ThemeColors.Orange500_50, - additionColor = ThemeColors.Blue600_30, - overlayColor = ThemeColors.Black_70 -) - -val SepiaColors = WikipediaColor( - primaryColor = ThemeColors.Gray700, - paperColor = ThemeColors.Beige100, - backgroundColor = ThemeColors.Beige300, - inactiveColor = ThemeColors.Taupe200, - placeholderColor = ThemeColors.Taupe600, - secondaryColor = ThemeColors.Gray600, - borderColor = ThemeColors.Beige400, - progressiveColor = ThemeColors.Blue600, - successColor = ThemeColors.Gray700, - destructiveColor = ThemeColors.Red700, - warningColor = ThemeColors.Yellow700, - highlightColor = ThemeColors.Yellow500, - focusColor = ThemeColors.Orange500, - additionColor = ThemeColors.Blue300_15, - overlayColor = ThemeColors.Black_30 -) diff --git a/app/src/main/java/org/wikipedia/compose/theme/WikipediaColor.kt b/app/src/main/java/org/wikipedia/compose/theme/WikipediaColor.kt new file mode 100644 index 00000000000..b1489ea5279 --- /dev/null +++ b/app/src/main/java/org/wikipedia/compose/theme/WikipediaColor.kt @@ -0,0 +1,117 @@ +package org.wikipedia.compose.theme + +import androidx.compose.runtime.Immutable +import androidx.compose.runtime.staticCompositionLocalOf +import androidx.compose.ui.graphics.Color +import org.wikipedia.compose.ComposeColors + +@Immutable +data class WikipediaColor( + val primaryColor: Color, + val paperColor: Color, + val backgroundColor: Color, + val inactiveColor: Color, + val placeholderColor: Color, + val secondaryColor: Color, + val borderColor: Color, + val progressiveColor: Color, + val successColor: Color, + val destructiveColor: Color, + val warningColor: Color, + val highlightColor: Color, + val focusColor: Color, + val additionColor: Color, + val overlayColor: Color +) + +val LocalWikipediaColor = staticCompositionLocalOf { + WikipediaColor( + primaryColor = Color.Unspecified, + paperColor = Color.Unspecified, + backgroundColor = Color.Unspecified, + inactiveColor = Color.Unspecified, + placeholderColor = Color.Unspecified, + secondaryColor = Color.Unspecified, + borderColor = Color.Unspecified, + progressiveColor = Color.Unspecified, + successColor = Color.Unspecified, + destructiveColor = Color.Unspecified, + warningColor = Color.Unspecified, + highlightColor = Color.Unspecified, + focusColor = Color.Unspecified, + additionColor = Color.Unspecified, + overlayColor = Color.Unspecified, + ) +} + +val LightColors = WikipediaColor( + primaryColor = ComposeColors.Gray700, + paperColor = ComposeColors.White, + backgroundColor = ComposeColors.Gray100, + inactiveColor = ComposeColors.Gray400, + placeholderColor = ComposeColors.Gray500, + secondaryColor = ComposeColors.Gray600, + borderColor = ComposeColors.Gray200, + progressiveColor = ComposeColors.Blue600, + successColor = ComposeColors.Green700, + destructiveColor = ComposeColors.Red700, + warningColor = ComposeColors.Yellow700, + highlightColor = ComposeColors.Yellow500, + focusColor = ComposeColors.Orange500, + additionColor = ComposeColors.Blue300_15, + overlayColor = ComposeColors.Black_30 +) + +val DarkColors = WikipediaColor( + primaryColor = ComposeColors.Gray200, + paperColor = ComposeColors.Gray700, + backgroundColor = ComposeColors.Gray675, + inactiveColor = ComposeColors.Gray500, + placeholderColor = ComposeColors.Gray400, + secondaryColor = ComposeColors.Gray300, + borderColor = ComposeColors.Gray650, + progressiveColor = ComposeColors.Blue300, + successColor = ComposeColors.Green600, + destructiveColor = ComposeColors.Red500, + warningColor = ComposeColors.Orange500, + highlightColor = ComposeColors.Yellow500_40, + focusColor = ComposeColors.Orange500_50, + additionColor = ComposeColors.Blue600_30, + overlayColor = ComposeColors.Black_70 +) + +val BlackColors = WikipediaColor( + primaryColor = ComposeColors.Gray200, + paperColor = ComposeColors.Black, + backgroundColor = ComposeColors.Gray700, + inactiveColor = ComposeColors.Gray500, + placeholderColor = ComposeColors.Gray500, + secondaryColor = ComposeColors.Gray300, + borderColor = ComposeColors.Gray675, + progressiveColor = ComposeColors.Blue300, + successColor = ComposeColors.Green600, + destructiveColor = ComposeColors.Red500, + warningColor = ComposeColors.Orange500, + highlightColor = ComposeColors.Yellow500_40, + focusColor = ComposeColors.Orange500_50, + additionColor = ComposeColors.Blue600_30, + overlayColor = ComposeColors.Black_70 +) + +val SepiaColors = WikipediaColor( + primaryColor = ComposeColors.Gray700, + paperColor = ComposeColors.Beige100, + backgroundColor = ComposeColors.Beige300, + inactiveColor = ComposeColors.Taupe200, + placeholderColor = ComposeColors.Taupe600, + secondaryColor = ComposeColors.Gray600, + borderColor = ComposeColors.Beige400, + progressiveColor = ComposeColors.Blue600, + successColor = ComposeColors.Gray700, + destructiveColor = ComposeColors.Red700, + warningColor = ComposeColors.Yellow700, + highlightColor = ComposeColors.Yellow500, + focusColor = ComposeColors.Orange500, + additionColor = ComposeColors.Blue300_15, + overlayColor = ComposeColors.Black_30 +) diff --git a/app/src/main/java/org/wikipedia/compose/WikipediaTheme.kt b/app/src/main/java/org/wikipedia/compose/theme/WikipediaTheme.kt similarity index 94% rename from app/src/main/java/org/wikipedia/compose/WikipediaTheme.kt rename to app/src/main/java/org/wikipedia/compose/theme/WikipediaTheme.kt index 7a3303046d3..d1aa7fb0078 100644 --- a/app/src/main/java/org/wikipedia/compose/WikipediaTheme.kt +++ b/app/src/main/java/org/wikipedia/compose/theme/WikipediaTheme.kt @@ -1,4 +1,4 @@ -package org.wikipedia.compose +package org.wikipedia.compose.theme import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.runtime.Composable @@ -9,7 +9,7 @@ enum class WikipediaThemeType { } @Composable -fun MainTheme( +fun BaseTheme( wikipediaThemeType: WikipediaThemeType = WikipediaThemeType.SYSTEM, content: @Composable () -> Unit ) {