Skip to content

Commit

Permalink
Add repository colors in OudsColorScheme
Browse files Browse the repository at this point in the history
  • Loading branch information
paulinea committed Dec 16, 2024
1 parent 5afadd4 commit 793bafe
Show file tree
Hide file tree
Showing 3 changed files with 315 additions and 1 deletion.
225 changes: 225 additions & 0 deletions core/src/main/java/com/orange/ouds/core/theme/OudsColorScheme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ data class OudsColorScheme(
val decorativeColors: Decorative,
val opacityColors: Opacity,
val overlayColors: Overlay,
val repositoryColors: Repository,
val surfaceColors: Surface,
) {

Expand Down Expand Up @@ -152,6 +153,60 @@ data class OudsColorScheme(
val modal: Color,
)

data class Repository(
val accentDefault: Color,
val accentHighest: Color,
val accentLow: Color,
val accentLowest: Color,
val infoDefault: Color,
val infoHighest: Color,
val infoLow: Color,
val infoLowest: Color,
val negativeDefault: Color,
val negativeHigh: Color,
val negativeHigher: Color,
val negativeHighest: Color,
val negativeLow: Color,
val negativeLower: Color,
val negativeLowest: Color,
val neutralEmphasizedBlack: Color,
val neutralEmphasizedHigh: Color,
val neutralEmphasizedHigher: Color,
val neutralEmphasizedHighest: Color,
val neutralEmphasizedMedium: Color,
val neutralMutedLower: Color,
val neutralMutedLowest: Color,
val neutralMutedWhite: Color,
val opacityBlackHigher: Color,
val opacityBlackHighest: Color,
val opacityBlackLow: Color,
val opacityBlackLower: Color,
val opacityBlackLowest: Color,
val opacityBlackMedium: Color,
val opacityBlackTransparent: Color,
val opacityInfo: Color,
val opacityNegative: Color,
val opacityPositive: Color,
val opacityWarning: Color,
val opacityWhiteHigh: Color,
val opacityWhiteHigher: Color,
val opacityWhiteHighest: Color,
val opacityWhiteLow: Color,
val opacityWhiteLower: Color,
val opacityWhiteLowest: Color,
val opacityWhiteTransparent: Color,
val positiveDefault: Color,
val positiveHighest: Color,
val positiveLow: Color,
val positiveLowest: Color,
val primaryDefault: Color,
val primaryLow: Color,
val warningDefault: Color,
val warningHighest: Color,
val warningLow: Color,
val warningLowest: Color,
)

data class Surface(
val brandPrimary: Color,
val statusAccentEmphasized: Color,
Expand Down Expand Up @@ -294,6 +349,61 @@ val OudsColorSemanticTokens.lightColorScheme: OudsColorScheme
modal = overlayModalLight
)
},
repositoryColors = with(repositoryColorTokens) {
OudsColorScheme.Repository(
accentDefault = repositoryAccentDefaultLight,
accentHighest = repositoryAccentHighestLight,
accentLow = repositoryAccentLowLight,
accentLowest = repositoryAccentLowestLight,
infoDefault = repositoryInfoDefaultLight,
infoHighest = repositoryInfoHighestLight,
infoLow = repositoryInfoLowLight,
infoLowest = repositoryInfoLowestLight,
negativeDefault = repositoryNegativeDefaultLight,
negativeHigh = repositoryNegativeHighLight,
negativeHigher = repositoryNegativeHigherLight,
negativeHighest = repositoryNegativeHighestLight,
negativeLow = repositoryNegativeLowLight,
negativeLower = repositoryNegativeLowerLight,
negativeLowest = repositoryNegativeLowestLight,
neutralEmphasizedBlack = repositoryNeutralEmphasizedBlackLight,
neutralEmphasizedHigh = repositoryNeutralEmphasizedHighLight,
neutralEmphasizedHigher = repositoryNeutralEmphasizedHigherLight,
neutralEmphasizedHighest = repositoryNeutralEmphasizedHighestLight,
neutralEmphasizedMedium = repositoryNeutralEmphasizedMediumLight,
neutralMutedLower = repositoryNeutralMutedLowerLight,
neutralMutedLowest = repositoryNeutralMutedLowestLight,
neutralMutedWhite = repositoryNeutralMutedWhiteLight,
opacityBlackHigher = repositoryOpacityBlackHigherLight,
opacityBlackHighest = repositoryOpacityBlackHighestLight,
opacityBlackLow = repositoryOpacityBlackLowLight,
opacityBlackLower = repositoryOpacityBlackLowerLight,
opacityBlackLowest = repositoryOpacityBlackLowestLight,
opacityBlackMedium = repositoryOpacityBlackMediumLight,
opacityBlackTransparent = repositoryOpacityBlackTransparentLight,
opacityInfo = repositoryOpacityInfoLight,
opacityNegative = repositoryOpacityNegativeLight,
opacityPositive = repositoryOpacityPositiveLight,
opacityWarning = repositoryOpacityWarningLight,
opacityWhiteHigh = repositoryOpacityWhiteHighLight,
opacityWhiteHigher = repositoryOpacityWhiteHigherLight,
opacityWhiteHighest = repositoryOpacityWhiteHighestLight,
opacityWhiteLow = repositoryOpacityWhiteLowLight,
opacityWhiteLower = repositoryOpacityWhiteLowerLight,
opacityWhiteLowest = repositoryOpacityWhiteLowestLight,
opacityWhiteTransparent = repositoryOpacityWhiteTransparentLight,
positiveDefault = repositoryPositiveDefaultLight,
positiveHighest = repositoryPositiveHighestLight,
positiveLow = repositoryPositiveLowLight,
positiveLowest = repositoryPositiveLowestLight,
primaryDefault = repositoryPrimaryDefaultLight,
primaryLow = repositoryPrimaryLowLight,
warningDefault = repositoryWarningDefaultLight,
warningHighest = repositoryWarningHighestLight,
warningLow = repositoryWarningLowLight,
warningLowest = repositoryWarningLowestLight,
)
},
surfaceColors = with(surfaceColorTokens) {
OudsColorScheme.Surface(
brandPrimary = surfaceBrandPrimaryLight,
Expand Down Expand Up @@ -437,6 +547,61 @@ val OudsColorSemanticTokens.darkColorScheme: OudsColorScheme
modal = overlayModalLight
)
},
repositoryColors = with(repositoryColorTokens) {
OudsColorScheme.Repository(
accentDefault = repositoryAccentDefaultDark,
accentHighest = repositoryAccentHighestDark,
accentLow = repositoryAccentLowDark,
accentLowest = repositoryAccentLowestDark,
infoDefault = repositoryInfoDefaultDark,
infoHighest = repositoryInfoHighestDark,
infoLow = repositoryInfoLowDark,
infoLowest = repositoryInfoLowestDark,
negativeDefault = repositoryNegativeDefaultDark,
negativeHigh = repositoryNegativeHighDark,
negativeHigher = repositoryNegativeHigherDark,
negativeHighest = repositoryNegativeHighestDark,
negativeLow = repositoryNegativeLowDark,
negativeLower = repositoryNegativeLowerDark,
negativeLowest = repositoryNegativeLowestDark,
neutralEmphasizedBlack = repositoryNeutralEmphasizedBlackDark,
neutralEmphasizedHigh = repositoryNeutralEmphasizedHighDark,
neutralEmphasizedHigher = repositoryNeutralEmphasizedHigherDark,
neutralEmphasizedHighest = repositoryNeutralEmphasizedHighestDark,
neutralEmphasizedMedium = repositoryNeutralEmphasizedMediumDark,
neutralMutedLower = repositoryNeutralMutedLowerDark,
neutralMutedLowest = repositoryNeutralMutedLowestDark,
neutralMutedWhite = repositoryNeutralMutedWhiteDark,
opacityBlackHigher = repositoryOpacityBlackHigherDark,
opacityBlackHighest = repositoryOpacityBlackHighestDark,
opacityBlackLow = repositoryOpacityBlackLowDark,
opacityBlackLower = repositoryOpacityBlackLowerDark,
opacityBlackLowest = repositoryOpacityBlackLowestDark,
opacityBlackMedium = repositoryOpacityBlackMediumDark,
opacityBlackTransparent = repositoryOpacityBlackTransparentDark,
opacityInfo = repositoryOpacityInfoDark,
opacityNegative = repositoryOpacityNegativeDark,
opacityPositive = repositoryOpacityPositiveDark,
opacityWarning = repositoryOpacityWarningDark,
opacityWhiteHigh = repositoryOpacityWhiteHighDark,
opacityWhiteHigher = repositoryOpacityWhiteHigherDark,
opacityWhiteHighest = repositoryOpacityWhiteHighestDark,
opacityWhiteLow = repositoryOpacityWhiteLowDark,
opacityWhiteLower = repositoryOpacityWhiteLowerDark,
opacityWhiteLowest = repositoryOpacityWhiteLowestDark,
opacityWhiteTransparent = repositoryOpacityWhiteTransparentDark,
positiveDefault = repositoryPositiveDefaultDark,
positiveHighest = repositoryPositiveHighestDark,
positiveLow = repositoryPositiveLowDark,
positiveLowest = repositoryPositiveLowestDark,
primaryDefault = repositoryPrimaryDefaultDark,
primaryLow = repositoryPrimaryLowDark,
warningDefault = repositoryWarningDefaultDark,
warningHighest = repositoryWarningHighestDark,
warningLow = repositoryWarningLowDark,
warningLowest = repositoryWarningLowestDark,
)
},
surfaceColors = with(surfaceColorTokens) {
OudsColorScheme.Surface(
brandPrimary = surfaceBrandPrimaryDark,
Expand Down Expand Up @@ -588,6 +753,65 @@ fun OudsColorScheme.fromToken(token: OudsColorKeyToken.Decorative): Color {
}
}

@Stable
fun OudsColorScheme.fromToken(token: OudsColorKeyToken.Repository): Color {
return with(repositoryColors) {
when (token) {
OudsColorKeyToken.Repository.Accent.Default -> accentDefault
OudsColorKeyToken.Repository.Accent.Highest -> accentHighest
OudsColorKeyToken.Repository.Accent.Low -> accentLow
OudsColorKeyToken.Repository.Accent.Lowest -> accentLowest
OudsColorKeyToken.Repository.Info.Default -> infoDefault
OudsColorKeyToken.Repository.Info.Highest -> infoHighest
OudsColorKeyToken.Repository.Info.Low -> infoLow
OudsColorKeyToken.Repository.Info.Lowest -> infoLowest
OudsColorKeyToken.Repository.Negative.Default -> negativeDefault
OudsColorKeyToken.Repository.Negative.High -> negativeHigh
OudsColorKeyToken.Repository.Negative.Higher -> negativeHigher
OudsColorKeyToken.Repository.Negative.Highest -> negativeHighest
OudsColorKeyToken.Repository.Negative.Low -> negativeLow
OudsColorKeyToken.Repository.Negative.Lower -> negativeLower
OudsColorKeyToken.Repository.Negative.Lowest -> negativeLowest
OudsColorKeyToken.Repository.Neutral.Emphasized.Black -> neutralEmphasizedBlack
OudsColorKeyToken.Repository.Neutral.Emphasized.High -> neutralEmphasizedHigh
OudsColorKeyToken.Repository.Neutral.Emphasized.Higher -> neutralEmphasizedHigher
OudsColorKeyToken.Repository.Neutral.Emphasized.Highest -> neutralEmphasizedHighest
OudsColorKeyToken.Repository.Neutral.Emphasized.Medium -> neutralEmphasizedMedium
OudsColorKeyToken.Repository.Neutral.Muted.Lower -> neutralMutedLower
OudsColorKeyToken.Repository.Neutral.Muted.Lowest -> neutralMutedLowest
OudsColorKeyToken.Repository.Neutral.Muted.White -> neutralMutedWhite
OudsColorKeyToken.Repository.Opacity.Black.Higher -> opacityBlackHigher
OudsColorKeyToken.Repository.Opacity.Black.Highest -> opacityBlackHighest
OudsColorKeyToken.Repository.Opacity.Black.Low -> opacityBlackLow
OudsColorKeyToken.Repository.Opacity.Black.Lower -> opacityBlackLower
OudsColorKeyToken.Repository.Opacity.Black.Lowest -> opacityBlackLowest
OudsColorKeyToken.Repository.Opacity.Black.Medium -> opacityBlackMedium
OudsColorKeyToken.Repository.Opacity.Black.Transparent -> opacityBlackTransparent
OudsColorKeyToken.Repository.Opacity.Info -> opacityInfo
OudsColorKeyToken.Repository.Opacity.Negative -> opacityNegative
OudsColorKeyToken.Repository.Opacity.Positive -> opacityPositive
OudsColorKeyToken.Repository.Opacity.Warning -> opacityWarning
OudsColorKeyToken.Repository.Opacity.White.High -> opacityWhiteHigh
OudsColorKeyToken.Repository.Opacity.White.Higher -> opacityWhiteHigher
OudsColorKeyToken.Repository.Opacity.White.Highest -> opacityWhiteHighest
OudsColorKeyToken.Repository.Opacity.White.Low -> opacityWhiteLow
OudsColorKeyToken.Repository.Opacity.White.Lower -> opacityWhiteLower
OudsColorKeyToken.Repository.Opacity.White.Lowest -> opacityWhiteLowest
OudsColorKeyToken.Repository.Opacity.White.Transparent -> opacityWhiteTransparent
OudsColorKeyToken.Repository.Positive.Default -> positiveDefault
OudsColorKeyToken.Repository.Positive.Highest -> positiveHighest
OudsColorKeyToken.Repository.Positive.Low -> positiveLow
OudsColorKeyToken.Repository.Positive.Lowest -> positiveLowest
OudsColorKeyToken.Repository.Primary.Default -> positiveDefault
OudsColorKeyToken.Repository.Primary.Low -> primaryLow
OudsColorKeyToken.Repository.Warning.Default -> warningDefault
OudsColorKeyToken.Repository.Warning.Highest -> warningHighest
OudsColorKeyToken.Repository.Warning.Low -> warningLow
OudsColorKeyToken.Repository.Warning.Lowest -> warningLowest
}
}
}

@Stable
fun OudsColorScheme.fromToken(token: OudsColorKeyToken.Surface): Color {
return with(surfaceColors) {
Expand Down Expand Up @@ -728,5 +952,6 @@ val OudsColorKeyToken.value: Color
is OudsColorKeyToken.Decorative -> OudsTheme.colorScheme.fromToken(this)
is OudsColorKeyToken.Opacity -> OudsTheme.colorScheme.fromToken(this)
is OudsColorKeyToken.Overlay -> OudsTheme.colorScheme.fromToken(this)
is OudsColorKeyToken.Repository -> OudsTheme.colorScheme.fromToken(this)
is OudsColorKeyToken.Surface -> OudsTheme.colorScheme.fromToken(this)
}
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,92 @@ sealed interface OudsColorKeyToken {
data object Tint900 : Skin
}
}

sealed interface Repository : OudsColorKeyToken {
sealed interface Accent : Repository {
data object Default : Accent
data object Highest : Accent
data object Low : Accent
data object Lowest : Accent
}

sealed interface Info : Repository {
data object Default : Info
data object Highest : Info
data object Low : Info
data object Lowest : Info
}

sealed interface Negative : Repository {
data object Default : Negative
data object High : Negative
data object Higher : Negative
data object Highest : Negative
data object Low : Negative
data object Lower : Negative
data object Lowest : Negative
}

sealed interface Neutral : Repository {
sealed interface Emphasized : Neutral {
data object Black : Emphasized
data object High : Emphasized
data object Higher : Emphasized
data object Highest : Emphasized
data object Medium : Emphasized
}

sealed interface Muted : Neutral {
data object Lower : Muted
data object Lowest : Muted
data object White : Muted
}
}

sealed interface Opacity : Repository {
sealed interface Black : Opacity {
data object Higher : Black
data object Highest : Black
data object Low : Black
data object Lower : Black
data object Lowest : Black
data object Medium : Black
data object Transparent : Black
}

data object Info : Opacity
data object Negative : Opacity
data object Positive : Opacity
data object Warning : Opacity
sealed interface White : Opacity {
data object High : White
data object Higher : White
data object Highest : White
data object Low : White
data object Lower : White
data object Lowest : White
data object Transparent : White
}
}

sealed interface Positive : Repository {
data object Default : Positive
data object Highest : Positive
data object Low : Positive
data object Lowest : Positive
}

sealed interface Primary : Repository {
data object Default : Primary
data object Low : Primary
}

sealed interface Warning : Repository {
data object Default : Warning
data object Highest : Warning
data object Low : Warning
data object Lowest : Warning
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ data class OudsColorSemanticTokens(
val opacityColorTokens: OudsColorOpacitySemanticTokens = OudsColorOpacitySemanticTokens(),
val overlayColorTokens: OudsColorOverlaySemanticTokens = OudsColorOverlaySemanticTokens(),
val surfaceColorTokens: OudsColorSurfaceSemanticTokens = OudsColorSurfaceSemanticTokens()
)
) {
val repositoryColorTokens: OudsColorRepositorySemanticTokens = OudsColorRepositorySemanticTokens()
}

0 comments on commit 793bafe

Please sign in to comment.