@fantasy-color/contrast-ratio-rgb
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

@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

Readme

Keywords

none

Package Sidebar

Install

npm i @fantasy-color/contrast-ratio-rgb

Weekly Downloads

2

Version

2.1.0

License

MIT

Unpacked Size

5.03 kB

Total Files

9

Last publish

Collaborators

  • ijigg
  • moria.am
  • atilaz
  • gideon.gur
  • irminakacz
  • fernando.3
  • xaviervia
  • psxcode
  • deepsweet