Skip to content

Commit 2733de3

Browse files
authored
Expose statusBarColor in CatppuccinTheme.Custom (#7)
* Expose statusBarColor in CatppuccinTheme.Custom * Bump version 0.1.2
1 parent 7798e35 commit 2733de3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

compose/src/main/java/com/shifthackz/catppuccin/compose/CatppuccinTheme.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import androidx.compose.material3.Shapes
1111
import androidx.compose.material3.Typography
1212
import androidx.compose.runtime.Composable
1313
import androidx.compose.runtime.SideEffect
14+
import androidx.compose.ui.graphics.Color
1415
import androidx.compose.ui.graphics.toArgb
1516
import androidx.compose.ui.platform.LocalView
1617
import androidx.core.graphics.luminance
@@ -90,6 +91,7 @@ object CatppuccinTheme {
9091
* @param colorScheme A complete definition of the Material Color theme for this hierarchy.
9192
* @param typography A set of text styles to be used as this hierarchy's typography system.
9293
* @param shapes A set of corner shapes to be used as this hierarchy's shape system.
94+
* @param statusBarColor A color to paint status bar with, by default uses surface theme color.
9395
* @param isAppearanceLightStatusBars If true, changes the foreground color of the status bars
9496
* to light so that the items on the bar can be read clearly.
9597
* @param content Child composable UI to theme.
@@ -102,15 +104,15 @@ object CatppuccinTheme {
102104
colorScheme: ColorScheme = Catppuccin.Latte.colorScheme(),
103105
typography: Typography = Catppuccin.Latte.typography(),
104106
shapes: Shapes = MaterialTheme.shapes,
107+
statusBarColor: Color = colorScheme.surface,
105108
isAppearanceLightStatusBars: Boolean,
106109
content: @Composable () -> Unit,
107110
) {
108111
val view = LocalView.current
109112
if (!view.isInEditMode) {
110113
SideEffect {
111114
val window = (view.context as Activity).window
112-
val statusBarColor = colorScheme.surface.toArgb()
113-
window.statusBarColor = statusBarColor
115+
window.statusBarColor = statusBarColor.toArgb()
114116
WindowCompat
115117
.getInsetsController(window, view)
116118
.isAppearanceLightStatusBars = isAppearanceLightStatusBars

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
catppuccin = "0.1.1"
2+
catppuccin = "0.1.2"
33
activityCompose = "1.8.2"
44
androidGradlePlugin = "8.2.0"
55
kotlin = "1.9.10"

0 commit comments

Comments
 (0)