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

Technical - Create and use an extension for disabled/enabled coloration #314

Closed
paulinea opened this issue Nov 7, 2022 · 0 comments · Fixed by #374
Closed

Technical - Create and use an extension for disabled/enabled coloration #314

paulinea opened this issue Nov 7, 2022 · 0 comments · Fixed by #374
Assignees

Comments

@paulinea
Copy link
Member

paulinea commented Nov 7, 2022

This is not the purpose of this MR but there is now a lot of copy(alpha = ContentAlpha.disabled) in the code. I don't know if this a good idea but we could add the following extensions:

val Color.disabled: Color
    @Composable
    get() = copy(alpha = ContentAlpha.disabled)

@Composable
fun Color.enabled(enabled: Boolean) = if (enabled) this else disabled
tint = OdsTheme.colors.onSurface.enabled(enabled = enabled)

Originally posted by @florentmaitre in #300 (comment)

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