refactor: modified the colors mix rules

This commit is contained in:
2023-11-20 02:18:09 +08:00
parent 1e998302dd
commit e55acce970
2 changed files with 31 additions and 28 deletions

View File

@@ -27,6 +27,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import com.highcapable.betterandroid.ui.extension.component.base.toMixColor
import com.highcapable.betterandroid.ui.extension.component.feature.SystemColors
@Composable
@@ -38,7 +39,7 @@ internal actual val DynamicLightColors
@ReadOnlyComposable
get() = if (SystemColors.isAvailable) Colors(
backgroundPrimary = Color(DynamicColors.materialDynamicNeutral(95)),
backgroundSecondary = Color(DynamicColors.materialDynamicNeutral(90)),
backgroundSecondary = Color(DynamicColors.materialDynamicNeutral(95) mix DynamicColors.materialDynamicNeutral(99)),
foregroundPrimary = Color(DynamicColors.materialDynamicNeutral(99)),
foregroundSecondary = Color(DynamicColors.materialDynamicNeutral(95)),
themePrimary = Color(DynamicColors.materialDynamicPrimary(60)),
@@ -54,7 +55,7 @@ internal actual val DynamicDarkColors
@ReadOnlyComposable
get() = if (SystemColors.isAvailable) Colors(
backgroundPrimary = Color(DynamicColors.materialDynamicNeutral(10)),
backgroundSecondary = Color(DynamicColors.materialDynamicNeutral(20)),
backgroundSecondary = Color(DynamicColors.materialDynamicNeutral(10) mix DynamicColors.materialDynamicNeutral(20)),
foregroundPrimary = Color(DynamicColors.materialDynamicNeutral(20)),
foregroundSecondary = Color(DynamicColors.materialDynamicNeutral(30)),
themePrimary = Color(DynamicColors.materialDynamicSecondary(60)),
@@ -70,7 +71,7 @@ internal actual val DynamicBlackColors
@ReadOnlyComposable
get() = if (SystemColors.isAvailable) Colors(
backgroundPrimary = Color(DynamicColors.materialDynamicNeutral(0)),
backgroundSecondary = Color(DynamicColors.materialDynamicNeutral(0)),
backgroundSecondary = Color(DynamicColors.materialDynamicNeutral(0) mix DynamicColors.materialDynamicNeutral(10)),
foregroundPrimary = Color(DynamicColors.materialDynamicNeutral(10)),
foregroundSecondary = Color(DynamicColors.materialDynamicNeutral(20)),
themePrimary = Color(DynamicColors.materialDynamicSecondary(60)),
@@ -84,4 +85,6 @@ internal actual val DynamicBlackColors
private val DynamicColors
@Composable
@ReadOnlyComposable
get() = SystemColors.from(LocalContext.current)
get() = SystemColors.from(LocalContext.current)
private infix fun Int.mix(other: Int) = toMixColor(other)