Create custom palettes with ColorfulColors
mainYou can define your own repeatable color palettes by conforming an enum or type to the ColorfulColors protocol. This allows your custom themes to be used seamlessly with both ColorfulView (SwiftUI) and setColors (UIKit/AppKit).
enum MarketingTheme: ColorfulColors {
case hero
var colors: [ColorElement] {
[
make(227, 108, 155),
make(134, 90, 214),
make(73, 204, 236),
make(35, 219, 167)
]
}
}
// Usage in SwiftUI
ColorfulView(color: MarketingTheme.hero)
// Usage in UIKit
animatedView.setColors(MarketingTheme.hero)