@noaigniteutilscolorContrast

colorContrast

Accepts a HEX baseColor and any number of HEX colors and returns the color with the highest contrast ratio.

  • @param baseColor - The base color to compare against.
  • @param restColors - Any number of colors to compare against the base color.
  • @returns An object containing the color with the highest contrast ratio.

Example

colorContrast('#51f', '#821522', '#dde', 'f3a')
// { contrast: '#dde', contrastRatio: 5.38, colorAA: '#dde', colorAAA: '#fff' }