SwiftUI uses the Color type to define colors throughout your app. Colors can be defined inline, as constants in a theme file, or through the Xcode asset catalog. PaletteRx exports Swift code with named constants that you can drop into your project.
How SwiftUI Handles Color
SwiftUI's Color type accepts RGB values in the 0.0 to 1.0 range (not 0-255). Colors defined in the asset catalog automatically support light and dark mode variants. System colors like .accentColor adapt to platform conventions.
Your custom brand colors need to coexist with these system colors. PaletteRx's role system helps: Primary becomes your accent color, bases provide backgrounds, and your palette integrates alongside iOS system colors.
Exporting from PaletteRx
Select SwiftUI from the Native Apps section in PaletteRx's export step. The output generates a Swift struct with static Color constants, each initialized with the correct 0.0-1.0 RGB values calculated from your hex palette. It also generates a ColorScheme configuration mapping your roles to SwiftUI's semantic color properties.
Integration Approaches
For the code approach: copy the generated Swift struct into your project. Reference colors as PaletteRx.primary throughout your views.
For the asset catalog approach: create Color Sets in Xcode's Assets.xcassets using the hex values from PaletteRx. This enables per-appearance variants (light/dark) and accessibility contrast variants.
Dark Mode Considerations
iOS requires colors that work in both light and dark modes. Build two palettes in PaletteRx — one for light mode and one for dark mode — and use the asset catalog's appearance variants to switch between them automatically.
.accentColor modifier sets the tint for interactive elements. Use your PaletteRx Primary color as the accent color for a consistent, branded interactive experience across your entire app.