TerminalContrast class abstract final

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) between a and b.
enforceMinimumContrast(Color fg, Color bg, {required double minRatio, bool hasExplicitBackground = false}) → Color
Adjusts fg lightness in OKLab until contrast against bg meets minRatio (1.0..21.0), preserving hue as much as the sRGB gamut allows.
ensureReadableTextOn(Color preferredText, Color fill) → Color
Returns either preferredText or a high-contrast black/white fallback for drawing text over fill.
relativeLuminance(Color color) → double
Returns relative luminance (0.0..1.0) per WCAG 2.1.
shouldSkipContrastAdjustment(String grapheme) → bool
Whether grapheme is a space, box-drawing, block element, or Powerline symbol whose exact color should not be contrast-shifted.