Skip to main content

Your first theme

Every skin ships a starter theme function. You give it your brand color, a font and light or dark; it returns a complete theme.

A brand color​

import androidx.compose.ui.graphics.Color

val brand = Color(0xFF0B57D0)

CamouflageProvider(
skin = MaterialSkin,
theme = materialTheme(seed = brand),
) { App() }

Each skin names the parameter for its own idea of a brand color: seed (Material), accent (Minimal, Cupertino, Carbon) and brand (Fluent).

Dark mode​

Dark mode is a flag on the theme, not a second theme you maintain. Follow the system setting:

import androidx.compose.foundation.isSystemInDarkTheme

@Composable
fun App() {
val dark = isSystemInDarkTheme()
CamouflageProvider(
skin = MaterialSkin,
theme = materialTheme(seed = brand, dark = dark),
) { Home() }
}

A font​

Skins never bundle fonts. Add the font to your app the normal way (Compose resources or a Flutter fonts: entry) and pass its family name:

materialTheme(seed = brand, fontFamily = myFontFamily) // a Compose FontFamily

Check it​

Brand colors can fail contrast. validate() tells you which pairs; it never changes your colors behind your back.

val theme = materialTheme(seed = brand)
theme.validate().forEach { println(it) }

Go deeper in Theming.