@unmilley/luminance

1.0.0 • Public • Published

@unmilley/luminance

A function to calculate the brightness of a color by its hex code and determine whether it is light or dark.

npm version npm downloads License

Usage

Install the package:

# pnpm
pnpm add @unmilley/luminance
# yarn
yarn add @unmilley/luminance
# npm
npm install @unmilley/luminance

Import:

import { luminance } from "@unmilley/luminance";

luminance("#000000"); // 'white'
luminance("ffffff"); // 'black'
luminance("808"); // 'white'

Development

local 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 💛

Readme

Keywords

none

Package Sidebar

Install

npm i @unmilley/luminance

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

5.69 kB

Total Files

6

Last publish

Collaborators

  • unmilley