feat(theme_picker): material you light & dark (#1059)
Co-authored-by: rhunk <101876869+rhunk@users.noreply.github.com>
This commit is contained in:
@@ -1061,7 +1061,8 @@
|
||||
"theme_picker": {
|
||||
"amoled_dark_mode": "AMOLED Dark Mode",
|
||||
"custom": "Custom Colors",
|
||||
"material_you": "Material You (Android 12+)",
|
||||
"material_you_light": "Material You Light (Android 12+)",
|
||||
"material_you_dark": "Material You Dark (Android 12+)",
|
||||
"light_blue": "Light Blue",
|
||||
"dark_blue": "Dark Blue",
|
||||
"earthy_autumn": "Earthy Autumn",
|
||||
|
||||
@@ -37,7 +37,8 @@ class UserInterfaceTweaks : ConfigContainer() {
|
||||
val themePicker = unique("theme_picker",
|
||||
"custom",
|
||||
"amoled_dark_mode",
|
||||
"material_you",
|
||||
"material_you_light",
|
||||
"material_you_dark",
|
||||
"light_blue",
|
||||
"dark_blue",
|
||||
"earthy_autumn",
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user