Contrast class
Utility methods for calculating contrast given two colors, or calculating a color given one color and a contrast ratio.
Contrast ratio is calculated using XYZ's Y. When linearized to match human perception, Y becomes HCT's tone and Lab*'s' L*. Informally, this is the lightness of a color.
Methods refer to tone, T in the the HCT color space. Tone is equivalent to L* in the Lab* color space, or L in the LCH color space.
Constructors
- Contrast()
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
- 
  darker({required double tone, required double ratio}) → double 
- 
  Returns a tone <= tonethat ensuresratio. Return value is between 0 and 100. Returns -1 ifratiocannot be achieved withtone.
- 
  darkerUnsafe({required double tone, required double ratio}) → double 
- 
  Returns a tone <= tonethat ensuresratio. Return value is between 0 and 100. Returns 0 ifratiocannot be achieved withtone.
- 
  lighter({required double tone, required double ratio}) → double 
- 
  Returns a tone >= tonethat ensuresratio. Return value is between 0 and 100. Returns -1 ifratiocannot be achieved withtone.
- 
  lighterUnsafe({required double tone, required double ratio}) → double 
- 
  Returns a tone >= tonethat ensuresratio. Return value is between 0 and 100. Returns 100 ifratiocannot be achieved withtone.
- 
  ratioOfTones(double toneA, double toneB) → double 
- 
  Returns a contrast ratio, which ranges from 1 to 21.
toneATone between 0 and 100. Values outside will be clamped.toneBTone between 0 and 100. Values outside will be clamped.