Update default colors
This commit is contained in:
@@ -29,7 +29,7 @@ fun GuardedPreference(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(MaterialTheme.shapes.extraSmall)
|
||||
.background(MaterialTheme.colorScheme.surface)
|
||||
.background(MaterialTheme.colorScheme.surfaceBright)
|
||||
) {
|
||||
if (locked) {
|
||||
Banner(
|
||||
|
||||
@@ -23,7 +23,7 @@ fun <T> ListPreference(
|
||||
items: List<ListPreferenceItem<T>>,
|
||||
value: T,
|
||||
summary: String? = items.firstOrNull { value == it.value }?.label,
|
||||
containerColor: Color = MaterialTheme.colorScheme.surface,
|
||||
containerColor: Color = MaterialTheme.colorScheme.surfaceBright,
|
||||
onValueChanged: (T) -> Unit,
|
||||
enabled: Boolean = true,
|
||||
itemLabel: @Composable RowScope.(item: ListPreferenceItem<T>) -> Unit = {
|
||||
|
||||
@@ -29,7 +29,7 @@ fun Preference(
|
||||
onClick: () -> Unit = {},
|
||||
controls: @Composable (() -> Unit)? = null,
|
||||
enabled: Boolean = true,
|
||||
containerColor: Color = MaterialTheme.colorScheme.surface,
|
||||
containerColor: Color = MaterialTheme.colorScheme.surfaceBright,
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
@@ -92,7 +92,7 @@ fun Preference(
|
||||
onClick: () -> Unit = {},
|
||||
controls: @Composable (() -> Unit)? = null,
|
||||
enabled: Boolean = true,
|
||||
containerColor: Color = MaterialTheme.colorScheme.surface,
|
||||
containerColor: Color = MaterialTheme.colorScheme.surfaceBright,
|
||||
) {
|
||||
Preference(
|
||||
title = {
|
||||
@@ -121,7 +121,7 @@ fun Preference(
|
||||
onClick: () -> Unit = {},
|
||||
controls: @Composable (() -> Unit)? = null,
|
||||
enabled: Boolean = true,
|
||||
containerColor: Color = MaterialTheme.colorScheme.surface,
|
||||
containerColor: Color = MaterialTheme.colorScheme.surfaceBright,
|
||||
) {
|
||||
Preference(
|
||||
title,
|
||||
|
||||
@@ -28,13 +28,9 @@ import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
||||
import androidx.compose.ui.input.nestedscroll.NestedScrollSource
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalViewConfiguration
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
@@ -157,8 +153,8 @@ fun PreferenceScreen(
|
||||
content = content,
|
||||
verticalArrangement = verticalArrangement,
|
||||
contentPadding = PaddingValues(
|
||||
top = it.calculateTopPadding(),
|
||||
bottom = it.calculateBottomPadding() + 4.dp,
|
||||
top = it.calculateTopPadding() + 12.dp,
|
||||
bottom = it.calculateBottomPadding() + 12.dp,
|
||||
start = 12.dp,
|
||||
end = 12.dp
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ fun PreferenceWithSwitch(
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.surface, MaterialTheme.shapes.extraSmall)
|
||||
modifier = Modifier.background(MaterialTheme.colorScheme.surfaceBright, MaterialTheme.shapes.extraSmall)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.weight(1f)
|
||||
|
||||
@@ -38,7 +38,7 @@ fun SliderPreference(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(MaterialTheme.colorScheme.surface, MaterialTheme.shapes.extraSmall)
|
||||
.background(MaterialTheme.colorScheme.surfaceBright, MaterialTheme.shapes.extraSmall)
|
||||
.padding(
|
||||
start = if (icon != null || iconPadding) 8.dp else 16.dp,
|
||||
end = 16.dp,
|
||||
|
||||
@@ -21,7 +21,7 @@ fun SwitchPreference(
|
||||
value: Boolean,
|
||||
onValueChanged: (Boolean) -> Unit,
|
||||
enabled: Boolean = true,
|
||||
containerColor: Color = MaterialTheme.colorScheme.surface,
|
||||
containerColor: Color = MaterialTheme.colorScheme.surfaceBright,
|
||||
) {
|
||||
Preference(
|
||||
title = title,
|
||||
|
||||
@@ -24,7 +24,7 @@ fun Color.Companion.hct(hue: Float, chroma: Float, tone: Float): Color {
|
||||
fun Color.atTone(tone: Int): Color {
|
||||
return Color(
|
||||
Hct.fromInt(this.toArgb()).apply {
|
||||
this.tone = tone.toDouble()
|
||||
this.setTone(tone.toDouble())
|
||||
}.toInt()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ fun ColorSchemePreferenceCategory(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(
|
||||
MaterialTheme.colorScheme.surfaceContainerLowest,
|
||||
MaterialTheme.colorScheme.surfaceContainerLow,
|
||||
MaterialTheme.shapes.extraSmall
|
||||
)
|
||||
.horizontalScroll(rememberScrollState())
|
||||
|
||||
@@ -65,15 +65,15 @@ import de.mm20.launcher2.ui.locals.LocalDarkTheme
|
||||
import de.mm20.launcher2.ui.theme.colorscheme.darkColorSchemeOf
|
||||
import de.mm20.launcher2.ui.theme.colorscheme.lightColorSchemeOf
|
||||
import de.mm20.launcher2.ui.theme.colorscheme.systemCorePalette
|
||||
import hct.Hct
|
||||
import kotlinx.serialization.Serializable
|
||||
import palettes.CorePalette
|
||||
import scheme.SchemeExpressive
|
||||
import java.util.UUID
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
@Serializable
|
||||
data class ColorSchemeSettingsRoute(
|
||||
@Serializable(with = UUIDSerializer::class) val id: UUID
|
||||
): NavKey
|
||||
) : NavKey
|
||||
|
||||
@Composable
|
||||
fun ColorSchemeSettingsScreen(themeId: UUID) {
|
||||
@@ -91,7 +91,7 @@ fun ColorSchemeSettingsScreen(themeId: UUID) {
|
||||
val previewColorScheme =
|
||||
theme?.let { if (previewDarkTheme) darkColorSchemeOf(it) else lightColorSchemeOf(it) }
|
||||
|
||||
val systemPalette = systemCorePalette()
|
||||
val systemPalette = systemCorePalette(dark)
|
||||
|
||||
val mergedCorePalette by remember(theme?.corePalette, systemPalette) {
|
||||
derivedStateOf {
|
||||
@@ -175,7 +175,9 @@ fun ColorSchemeSettingsScreen(themeId: UUID) {
|
||||
defaultValue = systemPalette.secondary,
|
||||
autoGenerate = {
|
||||
theme!!.corePalette.primary?.let {
|
||||
CorePalette.of(it).a2.keyColor.toInt()
|
||||
SchemeExpressive(
|
||||
Hct.fromInt(it), false, 0.0,
|
||||
).secondaryPaletteKeyColor
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -194,7 +196,9 @@ fun ColorSchemeSettingsScreen(themeId: UUID) {
|
||||
defaultValue = systemPalette.tertiary,
|
||||
autoGenerate = {
|
||||
theme!!.corePalette.primary?.let {
|
||||
CorePalette.of(it).a3.keyColor.toInt()
|
||||
SchemeExpressive(
|
||||
Hct.fromInt(it), false, 0.0,
|
||||
).tertiaryPaletteKeyColor
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -213,7 +217,9 @@ fun ColorSchemeSettingsScreen(themeId: UUID) {
|
||||
defaultValue = systemPalette.neutral,
|
||||
autoGenerate = {
|
||||
theme!!.corePalette.primary?.let {
|
||||
CorePalette.of(it).n1.keyColor.toInt()
|
||||
SchemeExpressive(
|
||||
Hct.fromInt(it), false, 0.0,
|
||||
).neutralPaletteKeyColor
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -232,7 +238,9 @@ fun ColorSchemeSettingsScreen(themeId: UUID) {
|
||||
defaultValue = systemPalette.neutralVariant,
|
||||
autoGenerate = {
|
||||
theme!!.corePalette.primary?.let {
|
||||
CorePalette.of(it).n2.keyColor.toInt()
|
||||
SchemeExpressive(
|
||||
Hct.fromInt(it), false, 0.0,
|
||||
).neutralVariantPaletteKeyColor
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -251,7 +259,9 @@ fun ColorSchemeSettingsScreen(themeId: UUID) {
|
||||
defaultValue = systemPalette.error,
|
||||
autoGenerate = {
|
||||
theme!!.corePalette.primary?.let {
|
||||
CorePalette.of(it).error.keyColor.toInt()
|
||||
SchemeExpressive(
|
||||
Hct.fromInt(it), false, 0.0,
|
||||
).errorPalette.keyColor.toInt()
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -790,7 +800,11 @@ fun ColorSchemeSettingsScreen(themeId: UUID) {
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Icon(painterResource(R.drawable.search_24px), null, tint = MaterialTheme.colorScheme.onSurface)
|
||||
Icon(
|
||||
painterResource(R.drawable.search_24px),
|
||||
null,
|
||||
tint = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1080,7 +1094,7 @@ fun ColorSchemeSettingsScreen(themeId: UUID) {
|
||||
}
|
||||
|
||||
IconButton(
|
||||
onClick = { },
|
||||
onClick = { },
|
||||
modifier = Modifier
|
||||
.padding(end = 16.dp)
|
||||
.align(Alignment.CenterVertically),
|
||||
|
||||
@@ -35,13 +35,13 @@ fun ColorSwatch(
|
||||
else 40f
|
||||
}
|
||||
it.apply {
|
||||
this.tone = tone.toDouble()
|
||||
this.setTone(tone.toDouble())
|
||||
}.toInt()
|
||||
})
|
||||
val borderColor = Color(Hct.fromInt(color.toArgb()).let {
|
||||
val tone = if (darkTheme) 30f else 80f
|
||||
it.apply {
|
||||
this.tone = tone.toDouble()
|
||||
this.setTone(tone.toDouble())
|
||||
}.toInt()
|
||||
})
|
||||
Box(
|
||||
|
||||
@@ -58,7 +58,7 @@ fun CorePaletteColorPreference(
|
||||
.clickable(
|
||||
onClick = { showDialog = true },
|
||||
)
|
||||
.background(MaterialTheme.colorScheme.surface)
|
||||
.background(MaterialTheme.colorScheme.surfaceBright)
|
||||
.padding(16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
|
||||
@@ -81,7 +81,7 @@ fun ThemeColorPreference(
|
||||
.clickable(
|
||||
onClick = { showDialog = true },
|
||||
)
|
||||
.background(MaterialTheme.colorScheme.surface)
|
||||
.background(MaterialTheme.colorScheme.surfaceBright)
|
||||
.padding(16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
|
||||
@@ -57,7 +57,7 @@ fun CrashReportScreen(fileName: String) {
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(MaterialTheme.shapes.medium)
|
||||
.background(MaterialTheme.colorScheme.surface)
|
||||
.background(MaterialTheme.colorScheme.surfaceBright)
|
||||
.horizontalScroll(
|
||||
rememberScrollState()
|
||||
),
|
||||
@@ -80,7 +80,7 @@ fun CrashReportScreen(fileName: String) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(MaterialTheme.colorScheme.surface, MaterialTheme.shapes.medium)
|
||||
.background(MaterialTheme.colorScheme.surfaceBright, MaterialTheme.shapes.medium)
|
||||
.padding(12.dp),
|
||||
) {
|
||||
Text(text = "Device Information", style = MaterialTheme.typography.titleMedium)
|
||||
|
||||
@@ -154,7 +154,7 @@ fun IconsSettingsScreen() {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.background(
|
||||
MaterialTheme.colorScheme.surfaceContainerLowest,
|
||||
MaterialTheme.colorScheme.surfaceContainerLow,
|
||||
MaterialTheme.shapes.extraSmall
|
||||
)
|
||||
.padding(vertical = 24.dp, horizontal = 8.dp)
|
||||
|
||||
@@ -414,7 +414,7 @@ fun ShapePreference(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(MaterialTheme.shapes.extraSmall)
|
||||
.background(MaterialTheme.colorScheme.surface)
|
||||
.background(MaterialTheme.colorScheme.surfaceBright)
|
||||
.clickable(
|
||||
onClick = { showDialog = true },
|
||||
)
|
||||
@@ -733,7 +733,7 @@ private fun ShapePreview(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(MaterialTheme.shapes.extraSmall)
|
||||
.background(MaterialTheme.colorScheme.surfaceContainerLowest)
|
||||
.background(MaterialTheme.colorScheme.surfaceContainerLow)
|
||||
.horizontalScroll(rememberScrollState())
|
||||
.padding(16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
|
||||
@@ -232,7 +232,7 @@ private fun TransparencyPreference(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(MaterialTheme.shapes.extraSmall)
|
||||
.background(MaterialTheme.colorScheme.surface)
|
||||
.background(MaterialTheme.colorScheme.surfaceBright)
|
||||
.padding(16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
|
||||
@@ -777,7 +777,7 @@ private fun FontPreference(
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.background(
|
||||
MaterialTheme.colorScheme.surface,
|
||||
MaterialTheme.colorScheme.surfaceBright,
|
||||
MaterialTheme.shapes.extraSmall
|
||||
)
|
||||
) {
|
||||
@@ -1309,7 +1309,7 @@ private fun TypographyPreview(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(MaterialTheme.shapes.extraSmall)
|
||||
.background(MaterialTheme.colorScheme.surfaceContainerLowest)
|
||||
.background(MaterialTheme.colorScheme.surfaceContainerLow)
|
||||
.horizontalScroll(rememberScrollState())
|
||||
.padding(16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
|
||||
@@ -20,21 +20,27 @@ import de.mm20.launcher2.themes.colors.Colors as ThemeColors
|
||||
import de.mm20.launcher2.themes.colors.get
|
||||
import de.mm20.launcher2.themes.colors.merge
|
||||
import de.mm20.launcher2.ui.locals.LocalWallpaperColors
|
||||
import dynamiccolor.ColorSpec
|
||||
import hct.Hct
|
||||
import org.koin.compose.koinInject
|
||||
import scheme.SchemeContent
|
||||
import scheme.SchemeExpressive
|
||||
import scheme.SchemeNeutral
|
||||
import scheme.SchemeTonalSpot
|
||||
|
||||
@Composable
|
||||
fun lightColorSchemeOf(colors: ThemeColors): ColorScheme {
|
||||
return colorSchemeOf(colors.lightColorScheme.merge(DefaultLightColorScheme), colors.corePalette)
|
||||
return colorSchemeOf(false, colors.lightColorScheme.merge(DefaultLightColorScheme), colors.corePalette)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun darkColorSchemeOf(colors: ThemeColors): ColorScheme {
|
||||
return colorSchemeOf(colors.darkColorScheme.merge(DefaultDarkColorScheme), colors.corePalette)
|
||||
return colorSchemeOf(true, colors.darkColorScheme.merge(DefaultDarkColorScheme), colors.corePalette)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun colorSchemeOf(colorScheme: FullColorScheme, corePalette: PartialCorePalette): ColorScheme {
|
||||
val defaultPalette = systemCorePalette()
|
||||
fun colorSchemeOf(dark: Boolean, colorScheme: FullColorScheme, corePalette: PartialCorePalette): ColorScheme {
|
||||
val defaultPalette = systemCorePalette(dark)
|
||||
return remember(colorScheme, corePalette, defaultPalette) {
|
||||
val mergedCorePalette = corePalette.merge(defaultPalette)
|
||||
ColorScheme(
|
||||
@@ -79,7 +85,7 @@ fun colorSchemeOf(colorScheme: FullColorScheme, corePalette: PartialCorePalette)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun systemCorePalette(): CorePalette<Int> {
|
||||
fun systemCorePalette(dark: Boolean): CorePalette<Int> {
|
||||
val uiSettings: UiSettings = koinInject()
|
||||
val compatModeColors by remember {
|
||||
uiSettings.compatModeColors
|
||||
@@ -98,14 +104,20 @@ fun systemCorePalette(): CorePalette<Int> {
|
||||
}
|
||||
val wallpaperColors = LocalWallpaperColors.current
|
||||
return remember(wallpaperColors) {
|
||||
val corePalette = palettes.CorePalette.of(wallpaperColors.primary.toArgb())
|
||||
val corePalette = SchemeTonalSpot(
|
||||
Hct.fromInt(
|
||||
wallpaperColors.primary.toArgb()),
|
||||
dark,
|
||||
0.0,
|
||||
ColorSpec.SpecVersion.SPEC_2025,
|
||||
)
|
||||
CorePalette(
|
||||
primary = corePalette.a1.tone(40),
|
||||
secondary = corePalette.a2.tone(40),
|
||||
tertiary = corePalette.a3.tone(40),
|
||||
neutral = corePalette.n1.tone(40),
|
||||
neutralVariant = corePalette.n2.tone(40),
|
||||
error = corePalette.error.tone(40),
|
||||
primary = corePalette.primaryPaletteKeyColor,
|
||||
secondary = corePalette.secondaryPaletteKeyColor,
|
||||
tertiary = corePalette.tertiaryPaletteKeyColor,
|
||||
neutral = corePalette.neutralPaletteKeyColor,
|
||||
neutralVariant = corePalette.neutralVariantPaletteKeyColor,
|
||||
error = corePalette.errorPalette.keyColor.toInt(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user