Presets

A preset sets the colors and radius of every component.

How it works

Components use FLXTheme.default automatically. That default lives in DesignSystem/Theme/FLXThemeEnvironment.swift, so there's nothing to configure.

To use another preset in your whole app, change the default there:

private struct FLXThemeKey: EnvironmentKey {    static let defaultValue: FLXTheme = .sienna}

To use it in only part of your app, apply it to a view. Everything inside that view uses it:

SettingsView()    .flxTheme(.sienna)

Presets handle light and dark mode on their own.

Views the system draws, such as an alert's default button, use the app's AccentColor from the asset catalog instead. Set it to the preset's tint, listed under each preset below.

Default

Near-neutral surfaces and a warm charcoal primary. FLXTheme.default comes with the foundation and is active from the start.

FLXTheme.default preset on iPhone
FLXTheme.default preset on Mac

AccentColor: #4E3D37, and #9E7F75 in dark mode.

Sienna

Cream paper, burnt-earth ink, and a larger base radius.

FLXTheme.sienna preset on iPhone
FLXTheme.sienna preset on Mac

AccentColor: #423127, and #B67752 in dark mode.

pnpm dlx shadcn@latest add @swiftui-flx/preset-sienna

Create your own

A preset is a FLXTheme value. To change only a few tokens, start from an existing preset:

extension FLXTheme {    static let brand: FLXTheme = {        var theme = FLXTheme.sienna        theme.colors.primary = Color(flxLight: .indigo, dark: .mint)        theme.colors.tint = .indigo        theme.radius.base = 8        return theme    }()}

To set every color yourself, copy DesignSystem/Theme/Presets/FLXTheme+Default.swift, rename the preset, and change its colors and radius.

Then use it like any other preset:

SettingsView()    .flxTheme(.brand)