Skip to main content

API

Enumerations

EnumerationDescription
ColorNames-

Interfaces

InterfaceDescription
ColorScheme-
ColorSetA set of colors with different shades
ExpandedColorSetAn expanded color set with shades from 50 to 900
ExpandedColorThemeA theme with different color categories for an expanded palette
GenerateThemeOptionsOptions for generating a color theme
GetColorNameFromHexOptions-
GetColorNameFromHexOutput-
GetRgbaFromHexOptions-
GetRgbaFromHexOutput-
RegularColorThemeA theme with different color categories for a regular palette

Type Aliases

Type aliasDescription
ColorSchemeType-
ColorThemeA theme with different color categories for a color palette
HEX-
HSL-
ThemeTypeA theme type that varies based on the expandPalette boolean parameter

Functions

FunctionDescription
adjustHexColorAdjusts the brightness of a hex color by a given amount.
adjustSaturationAdjusts the saturation based on the lightness and whether the base color is light or dark.
checkAccessibilityChecks if the contrast ratio between two colors meets the WCAG AA standard for normal text
compareHEXColorsViaHSLCompares two hex colors via HSL
exportThemeToCSSExports the theme to CSS Variables on the root element
exportThemeToCSSVariablesOnlyExports the theme to CSS Variables on the root element
generateThemeGenerates a color theme based on the provided options
getColorNameFromHexRetrieves the color name from a given hexadecimal color code.
getColorNameFromHslRetrieves the color name from a given HSL color.
getColorNameFromRgbRetrieves the color name from a given RGB color.
getContrastRatioCalculate the contrast ratio between two colors
getContrastRatioWCAG20Calculate the WCAG 2.0 contrast ratio between two colors
getHEXfromHSLConverts an HSL color to a hex color
getHexFromRgbConverts an RGB color to a hexadecimal color code.
getHSLfromHEXConverts a hex color to an HSL color
getOppositeColorGet the opposite color for text based on the background color
getRgbaFromHexConverts a hexadecimal color code to RGBA format.
isHexColorCheck if a string is a valid hex color
isHSLColorChecks if a string is a valid HSL color
isRgbaColorCheck if a string is a valid RGBA color
isRgbColorCheck if a string is a valid RGB color
memoizedGenerateThemeMemoized version of generateTheme to improve performance for repeated calls with the same options.