Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The readme file seems to have errors. #241

Open
ronenfe opened this issue Nov 19, 2024 · 1 comment
Open

The readme file seems to have errors. #241

ronenfe opened this issue Nov 19, 2024 · 1 comment

Comments

@ronenfe
Copy link

ronenfe commented Nov 19, 2024

To generate a custom ColorScheme you simply need to call dynamicColorScheme() with your target seed color:

@Composable
fun MyTheme(
    seedColor: Color,
    useDarkTheme: Boolean = isSystemInDarkTheme(),
    content: @Composable () -> Unit
) {
    val colorScheme = rememberDynamicColorScheme(seedColor, useDarkTheme)

    MaterialTheme(
        colors = colorScheme.toMaterialColors(),
        content = content
    )
}

No value passed for parameter 'isAmoled'.
Unresolved reference 'toMaterialColors'.

I changed it to this, but I'm not sure the implications.

    @Composable
    fun MyTheme(
        seedColor: Color,
        useDarkTheme: Boolean = isSystemInDarkTheme(),
        content: @Composable () -> Unit
    ) {
        val colorScheme = rememberDynamicColorScheme(seedColor, useDarkTheme, true)

        MaterialTheme(
            colorScheme = colorScheme,
            content = content
        )
    }

@ronenfe
Copy link
Author

ronenfe commented Nov 19, 2024

Also I'm not sure how to work with it, I guess I will need to set each control color in runtime with attributes of this new theme? I don't have composable controls only views from xml layout.
How will I handle night mode changes? I currently use Material3 theme daynight which takes care of it and supports a dynamiccolor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant