Pure-Dart WCAG 2.1 contrast and OKLab lightness helpers for ANSI colors.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
contrastRatio(
Color a, Color b) → double -
Returns WCAG 2.1 contrast ratio (
1.0..21.0) betweenaandb. -
enforceMinimumContrast(
Color fg, Color bg, {required double minRatio, bool hasExplicitBackground = false}) → Color -
Adjusts
fglightness in OKLab until contrast againstbgmeetsminRatio(1.0..21.0), preserving hue as much as the sRGB gamut allows. -
ensureReadableTextOn(
Color preferredText, Color fill) → Color -
Returns either
preferredTextor a high-contrast black/white fallback for drawing text overfill. -
relativeLuminance(
Color color) → double -
Returns relative luminance (
0.0..1.0) per WCAG 2.1. -
shouldSkipContrastAdjustment(
String grapheme) → bool -
Whether
graphemeis a space, box-drawing, block element, or Powerline symbol whose exact color should not be contrast-shifted.