Protocol
ColorMultipleSemanticTokens
This is a group of semantic tokens for colors but using MultipleColorSemanticToken.
protocol ColorMultipleSemanticTokens
Overview
In fact the MultipleColorSemanticToken class will help users (i.e. developers) to handle one semantic token for color containing values for light and dark modes. Because Figma is not able to manage pair of values for one token, and its produced JSON does not reflect this mecanism, the tokenator cannot provide such MultipleColorSemanticToken. Thus the “real” color semantic tokens are declared in ColorSemanticTokens protocol and defined inside a OUDSTheme. These tokens are updated by the tokenator. Then they are gathered and wrapped so as to be used easily thanks to this ColorMultipleSemanticTokens which must be updated manually.
In few words:
// Some color raw tokens, defined by the tokenator (in ColorRawTokens+Values.swift)
public static let colorDecorativeAmber100: ColorRawToken = "#FFF0CC00"
public static let colorDecorativeAmber200: ColorRawToken = "#FFE199FF"
// The color semantic tokens using them
// declared (in ColorSemanticTokens.swift) and defined (in OUDSTheme+ColorSemanticTokens.swift) by the tokenator
var bgPrimary: ColorSemanticTokens { ColorRawTokens.colorDecorativeAmber100 }
var bgPrimaryDark: ColorSemanticTokens { ColorRawTokens.colorDecorativeAmber200 }
// The 'higher level' color semantic tokens wrapping them and exposed to users
// declared (in this ColorMultipleSemanticTokens.swift) and defined manualy (in OUDSTheme+ColorMultipleSemanticTokens.swift)
var bgPrimary: MultipleColorSemanticToken { MultipleColorSemanticToken(: bgPrimaryLight, dark: bgPrimaryDark) }
// Thus users can in their components use bgPrimary as defined in their design system
// (even if they are still able to use 'lower level' semantic tokens but it is more error-prone)
Since
0.8.0
Topics
Instance Properties