Theme Properties

MimiSDK provides a collection of properties that can be themed, which are automatically propogated through to every component of the SDK, provided by MimiTheme.

MimiTheme is a protocol which has a number of properties that it requires to be implemented:

var identifier: String

var colors: MimiUX.MimiColorBook { get }
var fonts: MimiUX.MimiFontBook { get }
var styles: MimiUX.MimiStyleBook { get }

Contents

General

identifier

A unique identifier for the theme. We suggest you use a similar format to your bundle identifier, with a descriptive trailing component. Something like:

com.company.app.theme.variant

Examples:

com.mimi.hearingtest.theme.light - Light variant
com.mimi.hearingtest.theme.dark - Dark variant

MimiColorBook

MimiColorBook provides a list of colors that can be customized to provide custom tinting to your Mimi experience. The color book will default to using a palette from the system, and you are able to override as many or as few as desired.

let colorBook: MimiColorBook = .init(.primaryTint(.red), .secondaryTint(.blue))

primaryTint

Tint color that is used as the primary color for foreground elements such as buttons, switches and other interactive components.

Generally, this color should be the primary color of your brand and is highly prevalent across all UI elements.

Examples:

MimiColor(red: 0.45, green: 0.23, blue: 0.95, alpha: 1.0)

MimiColor also supports the ability to specify a custom color/style to use for the .highlighted state:

MimiColor(red: 0.45, green: 0.23, blue: 0.95, alpha: 1.0).withHighlightColor(UIColor(red: 0.45, green: 0.23, blue: 0.95, alpha: 1.0)
MimiColor(red: 0.45, green: 0.23, blue: 0.95, alpha: 1.0).withHighlightStyle(.darken)
MimiColor(red: 0.45, green: 0.23, blue: 0.95, alpha: 1.0).withHighlightStyle(.lighten)

By default this will use .lighten if no highlight style or color is provided.

secondaryTint

Tint color that is used in conjunction with the primary tint to give contrast.

This color should not clash with your primary tint, but accompany it nicely.

Examples:

MimiColor(red: 0.45, green: 0.23, blue: 0.95, alpha: 1.0)

tertiaryTint

Tint color that is applied to mostly background elements, such as the background of an untoggled switch or progress bar.

This color should clearly indicate a background context, and not clash with the other tints as much as possible.

Examples:

MimiColor(.lightGray)

primaryForeground

Color used for primary elements that are typically interactive, such as the title labels within buttons which have a solid background.

This color should contrast nicely with your tint colors to provide a clear sense of interaction.

Examples:

MimiColor(.white)

secondaryForeground

Color used for secondary elements that are typically interactive, and appear on top of elements that are typically using background colors.

This color should contrast nicely with your background colors to provide a clear sense of interaction.

Examples:

MimiColor(.black)

primaryBackground

Color used as the primary background for main views. This is primarily applied to views that take up the whole screen.

Generally, this color should contrast well with your tint colors and also be rather mute and plain.

Examples:

MimiColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.0)

secondaryBackground

Color used as the secondary background for main views.

This color should contrast well with your tint colors and the primary background.

Examples:

MimiColor(red: 0.718, green: 0.631, blue: 0.894, alpha: 1.0)

elevatedBackground

Color used for the background of non-primary views, such as modal views that don’t fill the screen. This includes alert views, navigation bars and tab bars.

This color should be similar to your primary background, but also discernable enough that a sense of context is clear. A user should be able to clearly see they are in a modal with the help of other built-in effects such as overlays and shadows.

Examples:

MimiColor(.white)

primaryText

Text color that is applied to all primary text elements.

This will mostly be applied to labels that are not control elements, and must contrast effectively with your background colors.

Examples:

MimiColor(.black)

secondaryText

Text color that is applied to all secondary / background text elements.

This will mostly be applied to labels that are not control elements, and must contrast effectively with your background colors.

Examples:

MimiColor(.darkGray)

warning

Color that is used to indicate a non-fatal warning or error.

This color can be used in a number of scenarios, such as the background color of an alert banner, or simply as the text color for a label describing an error. Therefore it is expected to be vivid and well contrasting against background elements.

Examples:

MimiColor(.systemOrange)

error

Color that is used to indicate a fatal error or failure.

This color can be used in a number of scenarios, such as the background color of an alert banner, or simply as the text color for a label describing an error. Therefore it is expected to be vivid and well contrasting against background elements.

Examples:

MimiColor(.systemRed)

MimiStyleBook

MimiStyleBook provides a collection of styling properties that can be customized to provide appearance and styling to your Mimi experience. The style book will default to using defaults from the system, and you are able to override as many or as few as desired.

let styleBook: MimiStyleBook = .init(.statusBar(.lightContent))

statusBar

Style of the system status bar

Examples:

.default
.lightContent

buttonCorner

Style of corners to use for large action buttons with a background.

Examples:

.rounded
.square
.eliptical

buttonDisplay

Style of large action button with a background.

Examples:

.fill
.outline

keyboardAppearance

Appearance to use for system keyboard.

Examples:

.default
.light

alert

Type of presenter for alerts. This MimiAlertPresenter conforming type will then be used for presentation of all alerts.

Examples:

UIAlertController.self
MimiAlertController.self

MimiFontBook

MimiFontBook provides a collection of fonts that can be customized to provide text styles to your Mimi experience. The font book will default to using defaults from the system, and you are able to override as many or as few as desired.

You are also able to create font books for individual user interface idioms.

let styleBook: MimiStyleBook = .init(.title(MimiFont.systemFont(ofSize: 14, weight: .medium)))

largeTitle

Font to use for large titles, typically seen as large, prominent headers.

title

Font to use for title elements, such as navigation bar titles.

action

Font to use for large action buttons.

compactAction

Font to use for compact action buttons.

body

Font to use for all body text elements.

bodyHighlight

Font to use for highlighted versions of body text elements, which are typically emboldened.

compactBody

Font to use for all small, compact body text elements.

compactBodyHighlight

Font to use for highlighted versions of small, compact body text elements, which are typically emboldened.