Package-level declarations

Types

Link copied to clipboard

WCAG thresholds used by the color generator.

Link copied to clipboard
value class Hue

A hue angle in degrees, always normalised to [0, 360). Create one with Hue(degrees), which wraps any angle (negative or beyond a full turn).

Link copied to clipboard
class HueState(initial: Hue)

Holds the session hue. The UI can re-roll it with shuffle ("Shuffle colors") or set a specific one through hue (e.g. from a hue slider). Reading hue in composition subscribes to changes.

Link copied to clipboard
data class TabotaboColors(val hue: Hue, val isDark: Boolean, val background: Color, val surface: Color, val primary: Color, val onPrimary: Color, val accent: Color, val muted: Color, val outline: Color, val outlineStrong: Color, val disabled: Color)

The design system's full palette. It is a superset of what M3's ColorScheme can express: accent and muted have no exact M3 slot.

Functions

Link copied to clipboard
fun contrastRatio(foreground: Color, background: Color): Double

WCAG 2.x contrast ratio between two opaque colors, in [1, 21].

Link copied to clipboard
fun Color.ensureContrast(target: Double, against: List<Color>): Color

Returns this color with its HSL lightness stepped away from against (in 0.01 steps) until its contrast is at least target against every color in against, or until lightness hits 0 or 1. Hue, saturation and alpha are kept. The direction is lighter when the first of against is dark, darker otherwise.

Link copied to clipboard
fun randomDarkColorScheme(random: Random = Random.Default): ColorScheme

Generates a random dark scheme. Shorthand for tabotaboDarkColorScheme(Hue.random(random)). Each call picks its own hue; build light and dark from one Hue when switching between them.

Link copied to clipboard
fun randomLightColorScheme(random: Random = Random.Default): ColorScheme

Generates a random light scheme. Shorthand for tabotaboLightColorScheme(Hue.random(random)). Each call picks its own hue; build light and dark from one Hue when switching between them.

Link copied to clipboard
fun rememberHueState(initial: () -> Hue = { Hue.random() }): HueState

Remembers a HueState for the session. The hue survives recomposition and configuration changes; a new one is generated on every cold launch / page load.

Link copied to clipboard

Builds the full palette for hue from the skill's HSL tone table, then nudges every text role's lightness away from the background until it reaches ContrastTargets.Text against both background and surface. TabotaboColors.outlineStrong gets the same nudge to ContrastTargets.Graphics; TabotaboColors.outline is left as is.

Link copied to clipboard

Dark M3 scheme for hue.

Link copied to clipboard

Light M3 scheme for hue.

Link copied to clipboard

Maps the palette onto Material3 roles so stock M3 components follow the scheme. Secondary and tertiary reuse TabotaboColors.primary (single hue), every surface container is TabotaboColors.surface, and surfaceTint is transparent so tonal elevation never tints. M3 outline (important boundaries) is TabotaboColors.outlineStrong and outlineVariant (decorative) is TabotaboColors.outline. The error roles are not overridden: they keep Material's own light / dark values.