Link Search Menu Expand Document

Dark Mode

The SDK supports dark mode, but it is disabled by default. It can be enabled or set to follow system settings.


Set up

You can configure dark mode support in the SDK by setting the property userInterfaceStyle in the CTStyle class.

By default, dark mode is off.

The following values are supported:

.dark // Forces to be always dark mode
.light // Default - Forces to be always light mode
.system // Use user system settings to determine if is light/dark mode

Dark mode colors can be configured using CTStyle and dark mode properties:

let style = CTStyle(theme: .dark,  // .dark or .light
                        primaryColor: UIColor.gray)
style.userInterfaceStyle = .system
style.dmPrimaryLightColor = UIColor.lightGray
style.dmPrimaryDarkColor = UIColor.darkGray
style.dmCtaColor = UIColor.blue
style.dmCtaFontColor = UIColor.white
style.dmSecondaryCtaColor = UIColor.black
style.dmSecondaryCtaFontColor = UIColor.white

After configuring the CTStyle object, pass it into the SDK during initialisation:

// In application(_:didFinishLaunchingWithOptions:)
    CarTrawlerSDK.sharedInstance().initialiseSDK(with: style,
                                customParameters: nil,
                                production: false)