Skip to content

Commit

Permalink
Clarify usage of alpha for scrim color.
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed Feb 26, 2025
1 parent 74289bd commit 8c58a73
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ fun SemanticColors.toMaterialColorSchemeDark(): ColorScheme = darkColorScheme(
outline = borderInteractivePrimary,
outlineVariant = DarkColorTokens.colorAlphaGray400,
// Note: for light it will be colorGray1400
scrim = DarkColorTokens.colorGray300.copy(alpha = 0.32f),
scrim = DarkColorTokens.colorGray300,
)
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ fun SemanticColors.toMaterialColorSchemeLight(): ColorScheme = lightColorScheme(
surfaceTint = LightColorTokens.colorGray1000,
inverseSurface = LightColorTokens.colorGray1300,
inverseOnSurface = textOnSolidPrimary,
error = textCriticalPrimary,
error = textCriticalPrimary,
onError = textOnSolidPrimary,
errorContainer = LightColorTokens.colorRed400,
onErrorContainer = textCriticalPrimary,
outline = borderInteractivePrimary,
outlineVariant = LightColorTokens.colorAlphaGray400,
// Note: for dark it will be colorGray300
scrim = LightColorTokens.colorGray1400.copy(alpha = 0.32f),
scrim = LightColorTokens.colorGray1400,
)
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ private fun MaterialPreview(
modifier = Modifier
.padding(12.dp)
.fillMaxWidth()
.background(color = MaterialTheme.colorScheme.scrim)
// the alpha applied to the scrim color does not seem to be mandatory.
// The library ignores the alpha level provided and apply it's own.
// For testing the color, manually set an alpha.
.background(color = MaterialTheme.colorScheme.scrim.copy(alpha = 0.32f))
.padding(16.dp),
text = "${"Scrim"}\n${MaterialTheme.colorScheme.scrim.toHrf()}",
style = LocalTextStyle.current.copy(fontFamily = FontFamily.Monospace),
Expand Down

0 comments on commit 8c58a73

Please sign in to comment.