Apply gradient to focused Event.
This commit is contained in:
parent
b3af5509c7
commit
1782e6d30b
4 changed files with 46 additions and 31 deletions
|
|
@ -34,26 +34,33 @@ fun Modifier.backgroundVerticalGradient(
|
|||
if (!isVisible) return this
|
||||
return background(
|
||||
brush = Brush.verticalGradient(
|
||||
colorStops = buildList {
|
||||
if (isEnterpriseBuild) {
|
||||
// For enterprise builds, ensure that we are theming the gradient
|
||||
add(0f to ElementTheme.colors.textActionAccent.copy(alpha = 0.5f))
|
||||
add(0.75f to ElementTheme.colors.bgCanvasDefault)
|
||||
add(1f to Color.Transparent)
|
||||
} else {
|
||||
add(0f to ElementTheme.colors.gradientSubtleStop1)
|
||||
add(1 / 5f to ElementTheme.colors.gradientSubtleStop2)
|
||||
add(2 / 5f to ElementTheme.colors.gradientSubtleStop3)
|
||||
add(3 / 5f to ElementTheme.colors.gradientSubtleStop4)
|
||||
add(4 / 5f to ElementTheme.colors.gradientSubtleStop5)
|
||||
add(1f to ElementTheme.colors.gradientSubtleStop6)
|
||||
}
|
||||
}.toTypedArray(),
|
||||
colorStops = subtleColorStops(isEnterpriseBuild),
|
||||
),
|
||||
alpha = 0.75f,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun subtleColorStops(
|
||||
isEnterpriseBuild: Boolean = LocalBuildMeta.current.isEnterpriseBuild,
|
||||
): Array<Pair<Float, Color>> {
|
||||
return buildList {
|
||||
if (isEnterpriseBuild) {
|
||||
// For enterprise builds, ensure that we are theming the gradient
|
||||
add(0f to ElementTheme.colors.textActionAccent.copy(alpha = 0.5f))
|
||||
add(0.75f to ElementTheme.colors.bgCanvasDefault)
|
||||
add(1f to Color.Transparent)
|
||||
} else {
|
||||
add(0f to ElementTheme.colors.gradientSubtleStop1)
|
||||
add(1 / 5f to ElementTheme.colors.gradientSubtleStop2)
|
||||
add(2 / 5f to ElementTheme.colors.gradientSubtleStop3)
|
||||
add(3 / 5f to ElementTheme.colors.gradientSubtleStop4)
|
||||
add(4 / 5f to ElementTheme.colors.gradientSubtleStop5)
|
||||
add(1f to ElementTheme.colors.gradientSubtleStop6)
|
||||
}
|
||||
}.toTypedArray()
|
||||
}
|
||||
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun BackgroundVerticalGradientPreview() = ElementPreview {
|
||||
|
|
|
|||
|
|
@ -100,10 +100,6 @@ val SemanticColors.mentionPillBackground
|
|||
val SemanticColors.bigCheckmarkBorderColor
|
||||
get() = if (isLight) LightColorTokens.colorGray400 else DarkColorTokens.colorGray400
|
||||
|
||||
@OptIn(CoreColorToken::class)
|
||||
val SemanticColors.highlightedMessageBackgroundColor
|
||||
get() = if (isLight) LightColorTokens.colorGreen300 else DarkColorTokens.colorGreen300
|
||||
|
||||
// Badge colors
|
||||
|
||||
@OptIn(CoreColorToken::class)
|
||||
|
|
@ -148,7 +144,6 @@ internal fun ColorAliasesPreview() = ElementPreview {
|
|||
"temporaryColorBgSpecial" to ElementTheme.colors.temporaryColorBgSpecial,
|
||||
"iconSuccessPrimaryBackground" to ElementTheme.colors.iconSuccessPrimaryBackground,
|
||||
"bigCheckmarkBorderColor" to ElementTheme.colors.bigCheckmarkBorderColor,
|
||||
"highlightedMessageBackgroundColor" to ElementTheme.colors.highlightedMessageBackgroundColor,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue