Record Class ColorRoles.ContrastPair
java.lang.Object
java.lang.Record
com.iizix.prop.ColorRoles.ContrastPair
- Record Components:
foreground- The foreground role: text, or a mark such as a border.background- The background role it is drawn on.threshold- The ratio needed:ColorContrast.AA_TEXTfor text,ColorContrast.AA_NON_TEXTfor marks.
- Enclosing class:
ColorRoles
public static record ColorRoles.ContrastPair(ColorRoles.Role foreground, ColorRoles.Role background, double threshold) extends Record
A pair of roles whose contrast a theme is checked for: a foreground drawn on a background, and the WCAG 2.x ratio it needs.
- Author:
- Christopher Mindus
Constructor Summary
ConstructorsConstructorDescriptionContrastPair(ColorRoles.Role foreground, ColorRoles.Role background, double threshold) Creates an instance of aContrastPairrecord class.Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebackgroundrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theforegroundrecord component.final inthashCode()Returns a hash code value for this object.booleanisText()Checks if the pair is a text pair rather than a mark.doubleReturns the value of thethresholdrecord component.final StringtoString()Returns a string representation of this record class.
Constructor Details
ContrastPair
Creates an instance of aContrastPairrecord class.- Parameters:
foreground- the value for theforegroundrecord componentbackground- the value for thebackgroundrecord componentthreshold- the value for thethresholdrecord component
Method Details
isText
public boolean isText()Checks if the pair is a text pair rather than a mark.- Returns:
- true when the threshold is the text one.
toString
hashCode
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes.foreground
Returns the value of theforegroundrecord component.- Returns:
- the value of the
foregroundrecord component
background
Returns the value of thebackgroundrecord component.- Returns:
- the value of the
backgroundrecord component
threshold