@unmilley/luminance
v1.0.0
Published
A function to calculate the brightness of a color by its hex code and determine whether it is light or dark.
Readme
@unmilley/luminance
A function to calculate the brightness of a color by its hex code and determine whether it is light or dark.
Usage
Install the package:
# pnpm
pnpm add @unmilley/luminance
# yarn
yarn add @unmilley/luminance
# npm
npm install @unmilley/luminanceImport:
import { luminance } from "@unmilley/luminance";
luminance("#000000"); // 'white'
luminance("ffffff"); // 'black'
luminance("808"); // 'white'Development
- Clone this repository
- Install latest LTS version of Node.js
- Enable Corepack using
corepack enable - Install dependencies using
pnpm install - Run interactive tests using
pnpm dev
License
MIT. Made with 💛
