Stylianos Gakis
03/31/2023, 2:31 PMContentAlpha
which can help by providing a high,medium,low alpha, adjusted properly for light/dark mode. I don’t see an equivalent existing in material3.
If I want to make an item had medium alpha for example, right now I am doing
CompositionLocalProvider(LocalContentColor provides LocalContentColor.current.copy(ContentAlpha.medium))
But I am mixing LocalContentColor from m3 and ContentAlpha from m2, which makes me feel like I am either missing something, or that m3 doesn’t want you to do it this way.Albert Chang
03/31/2023, 3:03 PMKirill Grouchnikov
03/31/2023, 3:04 PMKirill Grouchnikov
03/31/2023, 3:06 PMsurface
and surfaceContainer
.Stylianos Gakis
03/31/2023, 3:08 PMStylianos Gakis
03/31/2023, 3:11 PMdisabledContentColor
and you got tokens specified for these cases https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]%20buttonColors&ss=androidx%2Fplatform%2Fframeworks%2Fsupport
But for a generic “This is some disabled text”, I guess I got to specify my own tokens which is more or less going to be what ContentAlpha does, and apply that as alpha to the contentColor.Kirill Grouchnikov
03/31/2023, 3:14 PMStylianos Gakis
03/31/2023, 3:16 PMdisabled: Boolean
parameter which is very convenient on the other hand.
Where is this last picture from in the docs?Kirill Grouchnikov
03/31/2023, 3:16 PMChris Sinco [G]
03/31/2023, 5:01 PMStylianos Gakis
03/31/2023, 10:06 PM// Disabled emphasis
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onSurface.copy(alpha = 0.38f)) {
Shouldn't the "onSurface" be contentColor? Since if you're somewhere where the text should be something else it should still work.
Also the 0.38f alpha for disabled seems to be used for the disabled alpha. I assume this time we don't get this special treatment where for high luminescence colors we get a slightly different one than when we got low luminescence. And since it's used universally, wouldn't it be very convenient for the m3 library to expose it as a constant somehow so that it doesn't feel like a magic number in all the places I'll be using it?
Also interesting that for m2, the default emphasis was that content alpha was 1f, so you had the default, and then the normal and disabled as a way to go 2 steps down this scale.
For m3 the default is FontWeight.Normal, and then you got the high emphasis (bolt) which is one step up, and the disabled which is one step down on this scale. Really hard to do a 1:1 mapping this way if your existing design has a normal (1f alpha) emphasis, and then 2 lower ones, since this doesn't match the m3 spec. But anyway, gonna have to figure smth out.Kirill Grouchnikov
03/31/2023, 11:37 PMStylianos Gakis
05/13/2023, 1:30 AMElevationTokens.Level2
which is 3.dp. And then this does this tonal elevation trick to get a different color.
It’s very confusing looking at the material docs and how they don’t exactly apply to what we also use in code, since I have to just trust that the right thing is used, and if I want to make a custom component myself trying to follow some of the specs defined there, I wouldn’t know how to achieve it.Kirill Grouchnikov
05/13/2023, 1:57 AMStylianos Gakis
05/13/2023, 11:05 AMKirill Grouchnikov
05/13/2023, 6:17 PMStylianos Gakis
05/13/2023, 6:43 PM