Just type npm install color-luminance-brightness
- It is calculates color is dark.
import {isDark} from "color-luminance-brightness";
const colorIsDark = isDark('#123456') // true || false
- It is calculates color is bright.
import {isBright} from "color-luminance-brightness";
const colorIsBright = isBright('#123456') // true || false
- It is calculates and returns luminance value of color between 1 and 0.
import {calculateLuminance} from "color-luminance-brightness";
const calculated = calculateLuminance(255, 255, 255) // 1
- It converts HEX code to RGB code.
import {hexToRgb} from "color-luminance-brightness";
const getRGB = hexToRgb('#ffffff') // [255, 255, 255]
- It converts RGB code to HEX code.
import {rgbToHex} from "color-luminance-brightness";
const getHEX = rgbToHex(255, 255, 255) // #ffffff
WHITE_LUMINANCE
: Pre-calculated luminance of whiteBLACK_LUMINANCE
: Pre-calculated luminance of black