2.1.0 • Published 3 years ago

@fantasy-color/contrast-ratio-rgb v2.1.0

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

@fantasy-color/contrast-ratio-rgb

Calculate the contrast ratio between two RGB objects.

type contrastRatioLuminance = (rgb1: RGB, rgb2: RGB) => number

Example usage:

import contrastRatioRgb from '@fantasy-color/contrast-ratio-rgb'

contrastRatioRgb(
  { red: 255, green: 0, blue: 0 },
  { red: 0, green: 0, blue: 255 }
)
// > 2.148936170212766