FUIThemeManager
public class FUIThemeManager
Manager class which supplies color palette values to Fiori components, and the UIColor.preferredFioriColor(...) API.
Changes made to the manager affect all future calls to UIColor.preferredFioriColor(...). Most components do not reload dynamically, so calls to the ThemeManager should happen at the beginning of the application lifecycle.
Note
AppDelegate.didFinishLaunching(withOptions...) is the recommended location.
Example Usage
// Pin palette version used by application to a specific version (defaults to `.latest`)
FUIThemeManager.shared.setPaletteVersion(.v3_x)
// Override some color definitions to match your application palette
FUIThemeManager.shared.setColor(.darkGray, for: .primary2, background: .light)
FUIThemeManager.shared.setHexColor("1b931d", for: .positive, background: .light)
-
Singleton instance shared by all application components.
Declaration
Swift
public static let shared: FUIThemeManager -
Method to allow selecting a specific version of the palette. Defaults to
latest.Declaration
Swift
public func setPaletteVersion(_ version: FUIPaletteVersion)Parameters
versionMajor version of the Fiori Design Guidelines. Note: does not match exactly to SDK release;
v3is introduced with SDK version 3.0 SP02. -
Method to allow supplying a complete custom palette implementation.
Note
It is more typical to use
setColor(...), orsetHexColor(...)to override specific palette values than to provide a full implementation.Declaration
Swift
public func setPalette(_ palette: FUIPalette)Parameters
paletteComplete palette implementation. Should include definitions for all consumed
FUIColorStyletypes. -
Accessor to current palette.
Note
It is unusual to need to read from the palette directly; generally, use theUIColor.preferredFioriColor(...)API.Declaration
Swift
public private(set) var palette: FUIPalette { get set } -
Helper method, to clear any override colors set via
setColor(...)orsetHexColor(...). Does not affect the base definition of the current palette.Declaration
Swift
public func reset() -
Method to supply a custom definition for a particular
FUIColorStyle. Will be applied to.lightbackground color scheme.Declaration
Swift
public func setColor(_ color: UIColor, for style: FUIColorStyle)Parameters
colorColor definition to override the base definition in the palette.
styleReference of
FUIColorStyleto which color is bound. -
Method to supply a custom definition for a particular
FUIColorStyleandFUIColorVariantcombination.Note
A
nilvalue forbackgroundwill default to.light.Declaration
Swift
public func setColor(_ color: UIColor, for style: FUIColorStyle, variant: FUIColorVariant?)Parameters
colorColor definition to override the base definition in the palette.
styleReference of
FUIColorStyleto which color is bound.variantReference of
FUIColorVariantto which color is bound. Defaults to.light. If no value is supplied for.dark, the value for.lightwill be read as a fallback. -
Method to supply a custom definition for a particular
FUIColorStyle. Will applied to.lightbackground color scheme.Declaration
Swift
public func setHexColor(_ hex: String, for style: FUIColorStyle)Parameters
hexColor definition as hexidecimal string to override the base definition in the palette.
styleReference of
FUIColorStyleto which color is bound. -
Method to supply a custom definition for a particular
FUIColorStyleandFUIColorVariantcombination.Declaration
Swift
public func setHexColor(_ hex: String, for style: FUIColorStyle, variant: FUIColorVariant)Parameters
hexColor definition as hexidecimal string to override the base definition in the palette.
styleReference of
FUIColorStyleto which color is bound.variantReference of
FUIColorVariantto which color is bound. Defaults to.light. If no value is supplied for.dark, the value for.lightwill be read as a fallback.