@fantasy-color/contrast-ratio-rgb
v2.1.0
Published
Calculate contrast ratio based on RGB input
Downloads
9
Keywords
Readme
@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