ColorPalette

A group of color tokens that collectively define a theme

Definition

public struct ColorPalette {
    public let background: ColorSet
    public let brandPrimary: ColorSet
    public let brandPrimaryLight: ColorSet
    public let buttonColor: ColorSet
    public let buttonFontColor: ColorSet
    public let danger: ColorSet
    public let dangerLight: ColorSet
    public let divider: ColorSet
    public let foreground: ColorSet
    public let icon: ColorSet
    public let inputLine: ColorSet
    public let loadingBackground: ColorSet
    public let loadingSpinner: ColorSet
    public let loadingText: ColorSet
    public let success: ColorSet
    public let text: ColorSet
    public let textSecondary: ColorSet

    public init(
        background: ColorSet,
        brandPrimary: ColorSet,
        brandPrimaryLight: ColorSet,
        buttonColor: ColorSet,
        buttonFontColor: ColorSet,
        danger: ColorSet,
        dangerLight: ColorSet,
        divider: ColorSet,
        foreground: ColorSet,
        icon: ColorSet,
        inputLine: ColorSet,
        loadingBackground: ColorSet,
        loadingSpinner: ColorSet,
        loadingText: ColorSet,
        success: ColorSet,
        text: ColorSet,
        textSecondary: ColorSet
    ) {
        self.background = background
        self.brandPrimary = brandPrimary
        self.brandPrimaryLight = brandPrimaryLight
        self.buttonColor = buttonColor
        self.buttonFontColor = buttonFontColor
        self.danger = danger
        self.dangerLight = dangerLight
        self.divider = divider
        self.foreground = foreground
        self.icon = icon
        self.inputLine = inputLine
        self.loadingBackground = loadingBackground
        self.loadingSpinner = loadingSpinner
        self.loadingText = loadingText
        self.success = success
        self.text = text
        self.textSecondary = textSecondary
    }
}

Properties

PropertyTypeDescription
backgroundColorSetThe surface color of many backgrounds throughout the UI.
brandPrimaryColorSetPrimary brand color applied to primary buttons and links
brandPrimaryLightColorSetThe foreground color of the entire remittance flow
buttonColorColorSetRepresents the main fill color for primary buttons and the outline color for secondary buttons.
buttonFontColorColorSetRepresents the font color for primary buttons.
dangerColorSetIndicates negative sentiment, for example on error states or destructive actions. Can be used as text or as a background.
dangerLightColorSetAccent color used alongside #danger.
dividerColorSetUsed to subtly separate different blocks of content.
foregroundColorSetUse for elevated surfaces that contain content.
iconColorSetFill and stroke colors for SVG icons
inputLineColorSetRepresents the border color of input fields
loadingBackgroundColorSetBackground color for full-page loading screens; can be customized to match branding.
loadingSpinnerColorSetSpinner color for full-page loading screens; customizable to match branding.
loadingTextColorSetText color for full-page loading screens; customizable to match branding.
successColorSetIndicates positive sentiment, for example in positive alerts. Can be used as text or as a background.
textColorSetUse to emphasize primary text content in relation to other elements nearby.
textSecondaryColorSetUse for most body text, labels, disclosures and in supportive elements that give context to content that's close to it.

Default

PropertyDark AppearanceLight Appearance
background #111111 #F3F4F6
brandPrimary #844FBB #934AE0
brandPrimaryLight #2B2332 #F3EDF8
buttonColor #527FFF #274BAF
buttonFontColor #FFFFFF #FFFFFF
danger #ED7083 #AA220F
dangerLight #533338 #F4E9E7
divider #313131 #E2E2E2
foreground #1F1F1F #FFFFFF
icon #7E7E7E #444444
inputLine #505050 #858585
loadingBackground #111111 #F3F4F6
loadingSpinner #844FBB #934AE0
loadingText #E3E3E3 #0E0F0C
success #008761 #008761
text #E3E3E3 #0E0F0C
textSecondary #B0B0B0 #454545

public extension ColorPalette {
    static let `default`: Self = .init(
        background: .init(
            darkAppearance: .init(
                red: Double(0x11) / 255.0,
                green: Double(0x11) / 255.0,
                blue: Double(0x11) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0xF3) / 255.0,
                green: Double(0xF4) / 255.0,
                blue: Double(0xF6) / 255.0
            )
        ),
        brandPrimary: .init(
            darkAppearance: .init(
                red: Double(0x84) / 255.0,
                green: Double(0x4F) / 255.0,
                blue: Double(0xBB) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0x93) / 255.0,
                green: Double(0x4A) / 255.0,
                blue: Double(0xE0) / 255.0
            )
        ),
        brandPrimaryLight: .init(
            darkAppearance: .init(
                red: Double(0x2B) / 255.0,
                green: Double(0x23) / 255.0,
                blue: Double(0x32) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0xF3) / 255.0,
                green: Double(0xED) / 255.0,
                blue: Double(0xF8) / 255.0
            )
        ),
        buttonColor: .init(
            darkAppearance: .init(
                red: Double(0x52) / 255.0,
                green: Double(0x7F) / 255.0,
                blue: Double(0xFF) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0x27) / 255.0,
                green: Double(0x4B) / 255.0,
                blue: Double(0xAF) / 255.0
            )
        ),
        buttonFontColor: .init(
            darkAppearance: .init(
                red: Double(0xFF) / 255.0,
                green: Double(0xFF) / 255.0,
                blue: Double(0xFF) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0xFF) / 255.0,
                green: Double(0xFF) / 255.0,
                blue: Double(0xFF) / 255.0
            )
        ),
        danger: .init(
            darkAppearance: .init(
                red: Double(0xED) / 255.0,
                green: Double(0x70) / 255.0,
                blue: Double(0x83) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0xAA) / 255.0,
                green: Double(0x22) / 255.0,
                blue: Double(0x0F) / 255.0
            )
        ),
        dangerLight: .init(
            darkAppearance: .init(
                red: Double(0x53) / 255.0,
                green: Double(0x33) / 255.0,
                blue: Double(0x38) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0xF4) / 255.0,
                green: Double(0xE9) / 255.0,
                blue: Double(0xE7) / 255.0
            )
        ),
        divider: .init(
            darkAppearance: .init(
                red: Double(0x31) / 255.0,
                green: Double(0x31) / 255.0,
                blue: Double(0x31) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0xE2) / 255.0,
                green: Double(0xE2) / 255.0,
                blue: Double(0xE2) / 255.0
            )
        ),
        foreground: .init(
            darkAppearance: .init(
                red: Double(0x1F) / 255.0,
                green: Double(0x1F) / 255.0,
                blue: Double(0x1F) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0xFF) / 255.0,
                green: Double(0xFF) / 255.0,
                blue: Double(0xFF) / 255.0
            )
        ),
        icon: .init(
            darkAppearance: .init(
                red: Double(0x7E) / 255.0,
                green: Double(0x7E) / 255.0,
                blue: Double(0x7E) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0x44) / 255.0,
                green: Double(0x44) / 255.0,
                blue: Double(0x44) / 255.0
            )
        ),
        inputLine: .init(
            darkAppearance: .init(
                red: Double(0x50) / 255.0,
                green: Double(0x50) / 255.0,
                blue: Double(0x50) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0x85) / 255.0,
                green: Double(0x85) / 255.0,
                blue: Double(0x85) / 255.0
            )
        ),
        loadingBackground: .init(
            darkAppearance: .init(
                red: Double(0x11) / 255.0,
                green: Double(0x11) / 255.0,
                blue: Double(0x11) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0xF3) / 255.0,
                green: Double(0xF4) / 255.0,
                blue: Double(0xF6) / 255.0
            )
        ),
        loadingSpinner: .init(
            darkAppearance: .init(
                red: Double(0x84) / 255.0,
                green: Double(0x4F) / 255.0,
                blue: Double(0xBB) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0x93) / 255.0,
                green: Double(0x4A) / 255.0,
                blue: Double(0xE0) / 255.0
            )
        ),
        loadingText: .init(
            darkAppearance: .init(
                red: Double(0xE3) / 255.0,
                green: Double(0xE3) / 255.0,
                blue: Double(0xE3) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0x0E) / 255.0,
                green: Double(0x0F) / 255.0,
                blue: Double(0x0C) / 255.0
            )
        ),
        success: .init(
            darkAppearance: .init(
                red: Double(0x00) / 255.0,
                green: Double(0x87) / 255.0,
                blue: Double(0x61) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0x00) / 255.0,
                green: Double(0x87) / 255.0,
                blue: Double(0x61) / 255.0
            )
        ),
        text: .init(
            darkAppearance: .init(
                red: Double(0xE3) / 255.0,
                green: Double(0xE3) / 255.0,
                blue: Double(0xE3) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0x0E) / 255.0,
                green: Double(0x0F) / 255.0,
                blue: Double(0x0C) / 255.0
            )
        ),
        textSecondary: .init(
            darkAppearance: .init(
                red: Double(0xB0) / 255.0,
                green: Double(0xB0) / 255.0,
                blue: Double(0xB0) / 255.0
            ),
            lightAppearance: .init(
                red: Double(0x45) / 255.0,
                green: Double(0x45) / 255.0,
                blue: Double(0x45) / 255.0
            )
        )
    )
}
private let colorPalette: ColorPalette = .default

Sample Usages

private let background: ColorSet = .init(
    anyAppearance: .init(
        red: Double(0xF3) / 255.0,
        green: Double(0xF4) / 255.0,
        blue: Double(0xF6) / 255.0
    )
)

...

private let colorPalette: ColorPalette = .init(
     background: background,
     brandPrimary: ...,
     brandPrimaryLight: ...,
     buttonColor: ...,
     buttonFontColor: ...,
     danger: ...,
     dangerLight: ...,
     divider: ...,
     foreground: ...,
     icon: ...,
     inputLine: ...,
     loadingBackground: ...,
     loadingSpinner: ...,
     loadingText: ...,
     success: ...,
     text: ...,
     textSecondary: ...
)
private let background: ColorSet = .init(
    darkAppearance: .init(
        red: Double(0x11) / 255.0,
        green: Double(0x11) / 255.0,
        blue: Double(0x11) / 255.0
    ),
    lightAppearance: .init(
        red: Double(0xF3) / 255.0,
        green: Double(0xF4) / 255.0,
        blue: Double(0xF6) / 255.0
    )
)

...

private let colorPalette: ColorPalette = .init(
     background: background,
     brandPrimary: ...,
     brandPrimaryLight: ...,
     buttonColor: ...,
     buttonFontColor: ...,
     danger: ...,
     dangerLight: ...,
     divider: ...,
     foreground: ...,
     icon: ...,
     inputLine: ...,
     loadingBackground: ...,
     loadingSpinner: ...,
     loadingText: ...,
     success: ...,
     text: ...,
     textSecondary: ...
)
private let background: ColorSet = .init(
    anyAppearance: .init(
        red: 0xF3 / 255.0,
        green: 0xF4 / 255.0,
        blue: 0xF6 / 255.0,
        alpha: 1.0
    )
)

...

private let colorPalette: ColorPalette = .init(
     background: background,
     brandPrimary: ...,
     brandPrimaryLight: ...,
     buttonColor: ...,
     buttonFontColor: ...,
     danger: ...,
     dangerLight: ...,
     divider: ...,
     foreground: ...,
     icon: ...,
     inputLine: ...,
     loadingBackground: ...,
     loadingSpinner: ...,
     loadingText: ...,
     success: ...,
     text: ...,
     textSecondary: ...
)
private let background: ColorSet = .init(
    darkAppearance: .init(
        red: 0x11 / 255.0,
        green: 0x11 / 255.0,
        blue: 0x11 / 255.0,
        alpha: 1.0
    ),
    lightAppearance: .init(
        red: 0xF3 / 255.0,
        green: 0xF4 / 255.0,
        blue: 0xF6 / 255.0,
        alpha: 1.0
    )
)

...

private let colorPalette: ColorPalette = .init(
     background: background,
     brandPrimary: ...,
     brandPrimaryLight: ...,
     buttonColor: ...,
     buttonFontColor: ...,
     danger: ...,
     dangerLight: ...,
     divider: ...,
     foreground: ...,
     icon: ...,
     inputLine: ...,
     loadingBackground: ...,
     loadingSpinner: ...,
     loadingText: ...,
     success: ...,
     text: ...,
     textSecondary: ...
)