feat(theme_picker): material you light & dark (#1059)

Co-authored-by: rhunk <101876869+rhunk@users.noreply.github.com>
This commit is contained in:
Jacob Thomas
2024-05-21 23:20:52 +01:00
committed by GitHub
parent a196092c2d
commit 718f2125ba
3 changed files with 22 additions and 20 deletions

View File

@@ -37,31 +37,31 @@ class CustomizeUI: Feature("Customize UI", loadParams = FeatureLoadParams.ACTIVI
"actionSheetBackgroundDrawable" to colorsConfig.actionMenuBackgroundColor.getNullable(),
"actionSheetRoundedBackgroundDrawable" to colorsConfig.actionMenuRoundBackgroundColor.getNullable(),
"sigExceptionColorCameraGridLines" to colorsConfig.cameraGridLines.getNullable(),
).apply {
}.filterValues { it != null }.map { (key, value) ->
).filterValues { it != null }.map { (key, value) ->
getAttribute(key) to value!!
}.toMap()
}
if (themePicker == "material_you") {
if (themePicker == "material_you_light" || themePicker == "material_you_dark") {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
val colorScheme = dynamicDarkColorScheme(context.androidContext)
val light = themePicker == "material_you_light"
themes.clear()
val surfaceVariant = (if (light) colorScheme.surfaceVariant else colorScheme.onSurfaceVariant).toArgb()
val background = (if (light) colorScheme.onBackground else colorScheme.background).toArgb()
themes[themePicker] = mapOf(
"sigColorTextPrimary" to colorScheme.onSurfaceVariant.toArgb(),
"sigColorChatChat" to colorScheme.onSurfaceVariant.toArgb(),
"sigColorChatPendingSending" to colorScheme.onSurfaceVariant.toArgb(),
"sigColorChatSnapWithSound" to colorScheme.onSurfaceVariant.toArgb(),
"sigColorChatSnapWithoutSound" to colorScheme.onSurfaceVariant.toArgb(),
"sigColorBackgroundMain" to colorScheme.background.toArgb(),
"sigColorBackgroundSurface" to colorScheme.background.toArgb(),
"listDivider" to colorScheme.primary.copy(alpha = 0.12f).toArgb(),
"actionSheetBackgroundDrawable" to colorScheme.background.toArgb(),
"actionSheetRoundedBackgroundDrawable" to colorScheme.background.toArgb(),
"sigExceptionColorCameraGridLines" to colorScheme.background.toArgb(),
).apply {
}.filterValues { true }.map { (key, value) ->
getAttribute(key) to value
}.toMap()
"sigColorTextPrimary" to surfaceVariant,
"sigColorChatChat" to surfaceVariant,
"sigColorChatPendingSending" to surfaceVariant,
"sigColorChatSnapWithSound" to surfaceVariant,
"sigColorChatSnapWithoutSound" to surfaceVariant,
"sigColorBackgroundMain" to background,
"sigColorBackgroundSurface" to background,
"listDivider" to colorScheme.onPrimary.copy(alpha = 0.12f).toArgb(),
"actionSheetBackgroundDrawable" to background,
"actionSheetRoundedBackgroundDrawable" to background,
"sigExceptionColorCameraGridLines" to background,
).map { getAttribute(it.key) to it.value }.toMap()
}
}