withAccent

fun withAccent(accent: Color, onAccent: Color): UiColorScheme

This scheme with one accent: accent becomes primary, primaryContainer, secondaryContainer and inversePrimary in material, with onAccent as the content colors on them, so stock Material 3 components and the colors that resolve to those roles, such as the page grid's ripple, take the accent rather than the old one. Every selection color of every screen follows it: the colors that resolve to those roles, the selected tab and the document info button included, are reset to unspecified, so they keep following material afterwards. The main toolbar's selected icon has no role to follow, it is the toolbar's icon color by default, so it is set to accent outright. Both toolbars keep the selected icon color they had when accent would not read on their bar at 3:1, as on the stock XML theme's colorPrimary toolbar accented with that same color. Everything else is kept, so an XML theme's surfaces and text stay as they are. The AI assistant's reply bubbles and buttons, which would otherwise follow the changed secondaryContainer, are pinned to the tonal colors they had: those four become concrete colors, so replace material before calling this, not after.

Return

The accented scheme.

Parameters

accent

The color that marks what is selected, on every screen.

onAccent

The color of icons and text drawn on accent.


fun withAccent(@ColorInt accent: Int, @ColorInt onAccent: Int): UiColorScheme

withAccent with packed ARGB colors, for Java.

Return

The accented scheme.

Parameters

accent

The color that marks what is selected, on every screen, as 0xAARRGGBB.

onAccent

The color of icons and text drawn on accent, as 0xAARRGGBB.