Skip to content

Commit

Permalink
Review: Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
paulinea committed Dec 18, 2024
1 parent 921f66f commit 02131a0
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions core/src/main/java/com/orange/ouds/core/theme/OudsColorScheme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -836,21 +836,25 @@ fun OudsColorScheme.fromToken(token: OudsColorKeyToken.Surface): Color {

@Stable
fun OudsColorScheme.fromToken(token: OudsColorKeyToken.Opacity): Color {
return when (token) {
OudsColorKeyToken.Opacity.Lower -> opacityColors.lower
OudsColorKeyToken.Opacity.Lowest -> opacityColors.lowest
OudsColorKeyToken.Opacity.Transparent -> opacityColors.transparent
return with(opacityColors) {
when (token) {
OudsColorKeyToken.Opacity.Lower -> lower
OudsColorKeyToken.Opacity.Lowest -> lowest
OudsColorKeyToken.Opacity.Transparent -> transparent
}
}
}


@Stable
fun OudsColorScheme.fromToken(token: OudsColorKeyToken.Overlay): Color {
return when (token) {
OudsColorKeyToken.Overlay.Default -> overlayColors.default
OudsColorKeyToken.Overlay.Drag -> overlayColors.drag
OudsColorKeyToken.Overlay.Emphasized -> overlayColors.emphasized
OudsColorKeyToken.Overlay.Modal -> overlayColors.modal
return with(overlayColors) {
when (token) {
OudsColorKeyToken.Overlay.Default -> default
OudsColorKeyToken.Overlay.Drag -> drag
OudsColorKeyToken.Overlay.Emphasized -> emphasized
OudsColorKeyToken.Overlay.Modal -> modal
}
}
}

Expand Down

0 comments on commit 02131a0

Please sign in to comment.