Component overrides
A theme can carry overrides for single components. Every field is optional; null keeps the skin's default. This is the right tool for "our buttons are 44 high and soft by default" without touching the skin.
- Kotlin
- Dart
import androidx.compose.ui.unit.dp
import com.srctool.camouflage.core.button.ButtonTheme
import com.srctool.camouflage.core.theme.Appearance
import com.srctool.camouflage.core.theme.CamoComponentThemes
val theme = materialTheme(seed = brand).copy(
components = CamoComponentThemes(
button = ButtonTheme(height = 44.dp, defaultAppearance = Appearance.Soft),
),
)
CamouflageProvider(skin = MaterialSkin, theme = theme) { App() }
Every component has its own override type (ButtonTheme, CheckboxTheme, ProgressTheme, …). The fields are the same as what the skin resolves: sizes, shapes, paddings, text styles and per-appearance colors. The parameters are listed on each component's page and in the API reference.
Scoping an override
A provider with a null skin or theme inherits from the one above. Nest providers to restyle one part of the app, for example a dark panel inside a light screen:
- Kotlin
- Dart
CamouflageProvider(theme = materialTheme(seed = brand, dark = true)) {
SidePanel() // inherits the skin, gets the dark theme
}
Your own token sets
A brand can also bring its own data (for example a BrandTokens with a logo color and a gradient) on the theme, and read it back anywhere below the provider. The token set interpolates, so animated theme changes include it.