Impl base app theme, change statusbar color

This commit is contained in:
2026-02-27 18:18:23 +03:00
parent 59c869d539
commit bc07ea421b
11 changed files with 230 additions and 53 deletions

View File

@@ -1,4 +1,4 @@
package ru.fincode.core.ui.components
package ru.fincode.tsudesk.core.ui.components
import androidx.compose.ui.graphics.vector.ImageVector

View File

@@ -0,0 +1,38 @@
package ru.fincode.tsudesk.core.ui.components
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.enableEdgeToEdge
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
@Composable
fun ConfigureSystemBars(
statusBarColor: Color,
navigationBarColor: Color = statusBarColor,
darkIcons: Boolean = false, // false = светлые иконки
) {
val context = LocalContext.current
val status = statusBarColor.toArgb()
val nav = navigationBarColor.toArgb()
SideEffect {
val activity = context as? ComponentActivity ?: return@SideEffect
activity.enableEdgeToEdge(
statusBarStyle = if (darkIcons) {
SystemBarStyle.light(status, status)
} else {
SystemBarStyle.dark(status)
},
navigationBarStyle = SystemBarStyle.auto(
lightScrim = nav,
darkScrim = nav,
detectDarkMode = { darkIcons }
)
)
}
}

View File

@@ -1,4 +1,4 @@
package ru.fincode.core.ui.components
package ru.fincode.tsudesk.core.ui.components
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme

View File

@@ -0,0 +1,7 @@
package ru.fincode.tsudesk.core.ui.theme
import androidx.compose.ui.graphics.Color
// Brand (ТулГУ / TSUDesk)
val BrandRed = Color(0xFF7C1D1D) // замени на точный бордовый
val OnBrand = Color(0xFFFFFFFF)

View File

@@ -0,0 +1,22 @@
package ru.fincode.tsudesk.core.ui.theme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
val LightColorScheme = lightColorScheme(
primary = androidx.compose.ui.graphics.Color(0xFF6750A4),
onPrimary = androidx.compose.ui.graphics.Color.White,
secondary = androidx.compose.ui.graphics.Color(0xFF625B71),
onSecondary = androidx.compose.ui.graphics.Color.White,
tertiary = androidx.compose.ui.graphics.Color(0xFF7D5260),
onTertiary = androidx.compose.ui.graphics.Color.White,
)
val DarkColorScheme = darkColorScheme(
primary = androidx.compose.ui.graphics.Color(0xFFD0BCFF),
onPrimary = androidx.compose.ui.graphics.Color(0xFF381E72),
secondary = androidx.compose.ui.graphics.Color(0xFFCCC2DC),
onSecondary = androidx.compose.ui.graphics.Color(0xFF332D41),
tertiary = androidx.compose.ui.graphics.Color(0xFFEFB8C8),
onTertiary = androidx.compose.ui.graphics.Color(0xFF492532),
)

View File

@@ -0,0 +1,24 @@
package ru.fincode.tsudesk.core.ui.theme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color
data class ExtendedColors(
val brand: Color,
val onBrand: Color,
val brandSoft: Color,
)
val LocalExtendedColors = staticCompositionLocalOf {
ExtendedColors(
brand = Color.Unspecified,
onBrand = Color.Unspecified,
brandSoft = Color.Unspecified,
)
}
object TSUDeskThemeExt {
val colors: ExtendedColors
@Composable get() = LocalExtendedColors.current
}

View File

@@ -0,0 +1,28 @@
package ru.fincode.tsudesk.core.ui.theme
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
@Composable
fun TSUDeskTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit
) {
val scheme = if (darkTheme) DarkColorScheme else LightColorScheme
val extended = ExtendedColors(
brand = BrandRed,
onBrand = OnBrand,
brandSoft = BrandRed.copy(alpha = 0.12f),
)
CompositionLocalProvider(LocalExtendedColors provides extended) {
MaterialTheme(
colorScheme = scheme,
typography = TSUDeskTypography,
content = content
)
}
}

View File

@@ -0,0 +1,5 @@
package ru.fincode.tsudesk.core.ui.theme
import androidx.compose.material3.Typography
val TSUDeskTypography = Typography()