Skip to content

Text Styles

This page documents all text styles provided by COUI, based on the actual implementation.

Using Text Styles

  • Use COUITheme.textStyles.<name> in composables.
  • The color of all styles is set from COUITheme.colorScheme.onBackground at runtime.

Styles

Line heights come from each couiTextAppearance*'s lineSpacingMultiplier, taken from the values-v35 bucket that ColorOS 16 resolves.

Style NameSizeWeightLine HeightCOUI text appearance
main17spNormal1.158emcouiTextAppearanceHeadline6
paragraph17spNormal1.158emcouiTextAppearanceBodyL
body116spNormal1.158emcouiTextAppearanceBodyL
body214spNormal1.2245emcouiTextAppearanceBody
button16spMedium1.263emcouiTextAppearanceButtonL
footnote113spNormal1.2245emcouiTextAppearanceBody
footnote211spNormal1.143emcouiTextAppearanceDescription
headline116spNormal1.158emcouiTextAppearanceHeadline6
headline216spNormal1.158emcouiTextAppearanceHeadline6
subtitle14spBold1.2245emcouiTextAppearanceBody
title132spNormal1.2322emcouiTextAppearanceHeadline1
title224spNormal1.2emcouiTextAppearanceHeadline3
title320spNormal1.1831emcouiTextAppearanceHeadline4
title418spNormal1.2381emcouiTextAppearanceHeadline5

TIP

COUI has no 11sp / 13sp / 17sp text appearance, so those styles borrow the multiplier of the closest tier by font size. headline1 is the exception that was measured rather than inferred: a ColorOS 16 preference title node is 21.71dp tall at 560 dpi, which is 16sp — not the 17sp inherited from Miuix.

Every style carries LineHeightStyle(alignment = Top, trim = None) to match Android's lineSpacingMultiplier: the extra leading sits below the line and is never trimmed. Compose's default centres the leading and trims it on the first and last line, which cancels the line height out entirely on single-line text.

Usage

kotlin
Text(
    text = "Title",
    style = COUITheme.textStyles.title2
)

Text(
    text = "Body",
    style = COUITheme.textStyles.body1
)

Customization

  • Override styles via defaultTextStyles(...) and pass to COUITheme(textStyles = ...).
kotlin
val customTextStyles = defaultTextStyles(
    title1 = TextStyle(
        fontSize = 36.sp,
        fontWeight = FontWeight.Bold
    )
)

val controller = remember { ThemeController(ColorSchemeMode.System) }
COUITheme(
    controller = controller,
    textStyles = customTextStyles
) { /* Content */ }

Changelog

Released under the Apache-2.0 License