Skip to main content
Primer Checkout iOS SDK is currently in beta (v3.0.0-beta.1). The API is subject to change before the stable release.
ColorOverrides lets you override individual color tokens used across the checkout UI. You pass an instance to PrimerCheckoutTheme via its colors parameter. Every property is an optional Color?. Any token you leave nil keeps the SDK’s internal default value. Light and dark appearances are resolved automatically by the SDK’s built-in design tokens, so a single override applies in both color schemes.
@available(iOS 15.0, *)
public struct ColorOverrides: Equatable {
  public init(
    primerColorBrand: Color? = nil,
    // ... all tokens below, each defaulting to nil
  )
}
Override base tokens such as primerColorBrand to recolor the whole UI in one change. Override semantic tokens (text, border, icon) only when you need a specific element to differ from what its base token resolves to.

Brand and primary

TokenTypeDescription
primerColorBrandColor?Primary brand color. Drives focus rings, loaders, and selected states by default.

Grays

Foundational neutral palette. Most semantic tokens (text, borders, icons) resolve from these.
TokenTypeDescription
primerColorGray000Color?Lightest gray. Background base.
primerColorGray100Color?Very light gray.
primerColorGray200Color?Light gray.
primerColorGray300Color?Medium-light gray.
primerColorGray400Color?Medium gray.
primerColorGray500Color?Gray.
primerColorGray600Color?Medium-dark gray.
primerColorGray700Color?Dark gray.
primerColorGray900Color?Darkest gray. Text base.

Semantic accents

TokenTypeDescription
primerColorGreen500Color?Success accent.
primerColorRed100Color?Error background.
primerColorRed500Color?Error accent.
primerColorRed900Color?Error text.
primerColorBlue500Color?Info accent.
primerColorBlue900Color?Link color.

Background and text

TokenTypeDescription
primerColorBackgroundColor?Primary background.
primerColorTextPrimaryColor?Main text.
primerColorTextSecondaryColor?Labels and descriptions.
primerColorTextPlaceholderColor?Input placeholders.
primerColorTextDisabledColor?Disabled text.
primerColorTextNegativeColor?Error messages.
primerColorTextLinkColor?Clickable links.

Border colors (outlined)

Applied to outlined inputs such as the card form fields, per interaction state.
TokenTypeDescription
primerColorBorderOutlinedDefaultColor?Default input border.
primerColorBorderOutlinedHoverColor?Hovered input border.
primerColorBorderOutlinedActiveColor?Active input border.
primerColorBorderOutlinedFocusColor?Focused input border.
primerColorBorderOutlinedDisabledColor?Disabled input border.
primerColorBorderOutlinedErrorColor?Error input border.
primerColorBorderOutlinedSelectedColor?Selected item border.
primerColorBorderOutlinedLoadingColor?Loading input border.

Border colors (transparent)

Used by elements with a transparent border surface, per interaction state.
TokenTypeDescription
primerColorBorderTransparentDefaultColor?Transparent border base.
primerColorBorderTransparentHoverColor?Hovered.
primerColorBorderTransparentActiveColor?Active.
primerColorBorderTransparentFocusColor?Focused.
primerColorBorderTransparentDisabledColor?Disabled.
primerColorBorderTransparentSelectedColor?Selected.

Icon colors

TokenTypeDescription
primerColorIconPrimaryColor?Default icon.
primerColorIconDisabledColor?Disabled icon.
primerColorIconNegativeColor?Error icon.
primerColorIconPositiveColor?Success icon.

Utility

TokenTypeDescription
primerColorFocusColor?Focus ring.
primerColorLoaderColor?Loading indicator.

Overriding colors

Pass a ColorOverrides instance into PrimerCheckoutTheme. Tokens you omit keep their SDK defaults.
import SwiftUI
import PrimerSDK

let theme = PrimerCheckoutTheme(
    colors: ColorOverrides(
        primerColorBrand: Color(red: 0.42, green: 0.36, blue: 0.91),
        primerColorTextPrimary: Color(red: 0.10, green: 0.10, blue: 0.12),
        primerColorBackground: Color(.systemBackground),
        primerColorBorderOutlinedError: .red
    )
)

struct CheckoutScreen: View {
    let clientToken: String

    var body: some View {
        PrimerCheckout(
            clientToken: clientToken,
            primerTheme: theme,
            onCompletion: { state in
                // handle the final PrimerCheckoutState
            }
        )
    }
}
Because light and dark values resolve through the SDK’s internal tokens, supply a dynamic Color (for example one backed by an asset catalog color set, or a UIColor with a dynamic provider) when you want different values per appearance.
Overriding a base token such as primerColorBrand cascades to every semantic token that resolves from it (focus ring, loader, selected borders), so you can recolor the checkout with a single change.

See also

PrimerTheme

The container that bundles color, shape, spacing, and typography overrides.

Shape Tokens

Override corner radius and border width tokens.

Typography Tokens

Override font, size, weight, and line height per text style.

Spacing Tokens

Override spacing and size scale tokens.