Optional
color: ColorInputthe color as one of the valid color input format.
Optional
opts: ConstructorOptionsStatic
hexkey: hex value value: string name ex. hexnames["f00"] --> "red"
Static
nameskey: 'real' color name value: hex value ex. names["red"] --> "f00"
Returns the input passed into the constructer used to create the tinycolor instance.
String representation of the color.
Optional
format: The format to be used when displaying the string representation. The accepted values are: "rgb", "prgb", "hex6", "hex3", "hex8", "name", "hsl", "hsv".
Static
equalsCompares two colors. Each colors can be any color inputs.
Optional
color1: ColorInputOptional
color2: ColorInputStatic
fromCreate a tinycolor instance based off the relative values. Works with any color formats
Optional
ratio: ColorInputWithoutInstancethe relative color/hue values to apply to the new instance.
Static
isEnsure that foreground and background color combinations meet WCAG2 guidelines.
the fore color wanted.
the back color wanted.
Optional
wcag2: WCAG2OptionsWCAG option. If the entire object is absent, function use the default of {level:"AA",size:"small"}.
Static
mixOptional
amount: numberStatic
mostGiven a base color and a list of possible foreground or background colors for that base, returns the most readable color. Optionally returns Black or White if the most readable color is unreadable.
Optional
args: MostReadableArgsand object with extra arguments
Static
randomStatic
readabilityCompares the two colors and returns the constrast between two colors as a number.
the first color to be used in the comparison.
the second color to be used in the comparison.
Create a tinycolor instance of the color named.