Companion

object Companion

Functions

Link copied to clipboard

Adjust a tone down such that white has 4.5 contrast, if the tone is reasonably close to supporting it.

Link copied to clipboard
fun foregroundTone(bgTone: Double, ratio: Double): Double

Given a background tone, find a foreground tone, while ensuring they reach a contrast ratio that is as close to ratio as possible.

Link copied to clipboard
fun fromArgb(name: String, argb: Int): DynamicColor

Create a DynamicColor from a hex code.

Link copied to clipboard
fun fromPalette(name: String, palette: (DynamicScheme) -> TonalPalette, tone: (DynamicScheme) -> Double, isBackground: Boolean): DynamicColor

A convenience constructor for DynamicColor.

Link copied to clipboard

Tones less than ~T50 always permit white at 4.5 contrast.

Link copied to clipboard

People prefer white foregrounds on ~T60-70. Observed over time, and also by Andrew Somers during research for APCA.