Skip to content

Commit 7c80e91

Browse files
committed
1
1 parent 91888d7 commit 7c80e91

File tree

5 files changed

+12
-27
lines changed

5 files changed

+12
-27
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ kotlin {
2727
@Composable
2828
fun App() {
2929
MiuixTheme(
30-
colorScheme = if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()
30+
colors = if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()
3131
) {
3232
// Other content...
3333
}

composeApp/src/commonMain/kotlin/ui/Theme.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fun AppTheme(
1313
) {
1414
val darkTheme = isSystemInDarkTheme()
1515
return MiuixTheme(
16-
colorScheme = when (colorMode) {
16+
colors = when (colorMode) {
1717
1 -> lightColorScheme()
1818
2 -> darkColorScheme()
1919
else -> if (darkTheme) darkColorScheme() else lightColorScheme()

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Button.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
3030
* @param enabled Whether the [Button] is enabled.
3131
* @param submit Whether the [Button] is a submit button.
3232
* @param cornerRadius The corner radius of the [Button].
33+
* @param minHeight The minimum height of the [Button].
3334
*/
3435
@Composable
3536
fun Button(

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/theme/Colors.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import androidx.compose.ui.graphics.Color
4343
* @param surface The surface color.
4444
* @param onSurface The color of the text on surface color.
4545
* @param surfaceVariant The variant color of the surface color.
46-
* @param onSurfaceSecondary The color of the dialog summary on surface variant color.
46+
* @param onSurfaceSecondary The color of the text on surface secondary color.
4747
* @param onSurfaceVariantSummary The color of the summary on surface variant color.
4848
* @param onSurfaceVariantActions The color of the actions on surface variant color.
4949
* @param disabledOnSurface The color of the text on disabled surface color.

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/theme/MiuixTheme.kt

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,27 @@ import top.yukonga.miuix.kmp.utils.MiuixIndication
1010
/**
1111
* The default theme that provides color and text styles for the Miuix components.
1212
*
13-
* @param colorScheme The color scheme for the Miuix components.
13+
* @param colors The color scheme for the Miuix components.
1414
* @param textStyles The text styles for the Miuix components.
1515
* @param content The content of the Miuix theme.
1616
*/
1717
@Composable
1818
fun MiuixTheme(
19-
colorScheme: Colors = MiuixTheme.colorScheme,
19+
colors: Colors = MiuixTheme.colorScheme,
2020
textStyles: TextStyles = MiuixTheme.textStyles,
2121
content: @Composable () -> Unit
2222
) {
23-
val miuixColors = remember { colorScheme.copy() }.apply { updateColorsFrom(colorScheme) }
24-
val miuixTextStyles = remember(colorScheme.onBackground) {
25-
defaultTextStyles(
26-
main = textStyles.main.copy(color = colorScheme.onBackground),
27-
title = textStyles.title.copy(color = colorScheme.onBackground),
28-
paragraph = textStyles.paragraph.copy(color = colorScheme.onBackground),
29-
body1 = textStyles.body1.copy(color = colorScheme.onBackground),
30-
body2 = textStyles.body2.copy(color = colorScheme.onBackground),
31-
button = textStyles.button.copy(color = colorScheme.onBackground),
32-
footnote1 = textStyles.footnote1.copy(color = colorScheme.onBackground),
33-
footnote2 = textStyles.footnote2.copy(color = colorScheme.onBackground),
34-
headline1 = textStyles.headline1.copy(color = colorScheme.onBackground),
35-
headline2 = textStyles.headline2.copy(color = colorScheme.onBackground),
36-
subtitle = textStyles.subtitle.copy(color = colorScheme.onBackground),
37-
title1 = textStyles.title1.copy(color = colorScheme.onBackground),
38-
title2 = textStyles.title2.copy(color = colorScheme.onBackground),
39-
title3 = textStyles.title3.copy(color = colorScheme.onBackground),
40-
title4 = textStyles.title4.copy(color = colorScheme.onBackground)
41-
)
23+
val miuixColors = remember { colors.copy() }.apply {
24+
updateColorsFrom(colors)
4225
}
43-
val miuixRipple = remember(colorScheme.onBackground) {
44-
MiuixIndication(backgroundColor = colorScheme.onBackground)
26+
val miuixTextStyles = remember { textStyles }
27+
val miuixIndication = remember(colors.onBackground) {
28+
MiuixIndication(backgroundColor = colors.onBackground)
4529
}
4630
CompositionLocalProvider(
4731
LocalColors provides miuixColors,
4832
LocalTextStyles provides miuixTextStyles,
49-
LocalIndication provides miuixRipple
33+
LocalIndication provides miuixIndication
5034
) {
5135
content()
5236
}

0 commit comments

Comments
 (0)