ContrastPolicy class final

Label-solving policy: floors plus the two WCAG-2 blind-spot heuristics (research §4.5). Immutable; configurable per family or Accessible lock.

Constructors

ContrastPolicy({double minRatio = ratioText, double darkFaceRatio = ratioAccessible, double darkFaceY = yDarkFace, bool polarityRule = true, bool darkFaceBoost = true})
const

Properties

darkFaceBoost → bool
Solve labels on dark faces to darkFaceRatio.
final
darkFaceRatio → double
Target on faces with luminance below darkFaceY (when darkFaceBoost).
final
darkFaceY → double
Luminance under which a face counts as dark.
final
hashCode → int
The hash code for this object.
no setterinherited
minRatio → double
The hard floor every label must reach.
final
polarityRule → bool
Prefer a light label on mid-tone faces (0.179 < Y < 0.342) whenever it reaches the floor.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

inPolarityBand(double faceY) → bool
Whether a face of luminance faceY is in the mid-tone polarity band.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
targetFor(double faceY) → double
The ratio to aim for on a face of luminance faceY.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

accessible → const ContrastPolicy
Accessible lock: 7:1 floor everywhere.
standard → const ContrastPolicy
Standard policy: 4.5:1 floor, 7:1 on dark faces, polarity rule on.