Skip to content

Commit

Permalink
Merge pull request #2352 from HedvigInsurance/design/link-color
Browse files Browse the repository at this point in the history
Use the new link color from design
  • Loading branch information
StylianosGakis authored Dec 12, 2024
2 parents cbef7fc + 69912c1 commit 6bb9af1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
package com.hedvig.android.design.system.hedvig

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.unit.dp
import com.halilibo.richtext.ui.BasicRichText
import com.halilibo.richtext.ui.LinkClickHandler
import com.halilibo.richtext.ui.RichTextScope
import com.halilibo.richtext.ui.RichTextStyle
import com.halilibo.richtext.ui.RichTextThemeProvider
import com.halilibo.richtext.ui.merge
import com.halilibo.richtext.ui.string.RichTextStringStyle

/**
* RichText implementation that integrates with HedvigTheme.
Expand All @@ -21,10 +30,19 @@ public fun RichText(
linkClickHandler: LinkClickHandler? = null,
children: @Composable RichTextScope.() -> Unit,
) {
val linkColor = HedvigTheme.colorScheme.link
val linkStyle = RichTextStyle.Default.copy(
stringStyle = RichTextStringStyle(
linkStyle = SpanStyle(
textDecoration = TextDecoration.Underline,
color = linkColor,
),
),
)
RichTextHedvigTheme {
BasicRichText(
modifier = modifier,
style = style,
style = linkStyle.merge(style),
linkClickHandler = linkClickHandler,
children = children,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal object ColorLightTokens {
val TextBlackTranslucent: Color = PaletteTokens.BlackTransparent
val TextWhiteTranslucent: Color = PaletteTokens.WhiteTransparent
val Action: Color = PaletteTokens.Red600
val Link: Color = PaletteTokens.Blue600
val Link: Color = PaletteTokens.Blue800
val ButtonPrimaryResting: Color = PaletteTokens.Black
val ButtonPrimaryHover: Color = PaletteTokens.G900TDark
val ButtonPrimaryDisabled: Color = PaletteTokens.G100
Expand Down

0 comments on commit 6bb9af1

Please sign in to comment.