Socket
Book a DemoInstallSign in
Socket

@bkwld/light-or-dark

Package Overview
Dependencies
Maintainers
5
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bkwld/light-or-dark

Return whether a hex or rgb color is light or dark

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
5
Created
Source

light-or-dark

A micro package for returning whether a hex or rgb color is light or dark.

Based on https://awik.io/determine-color-bright-dark-using-javascript/.

Install

npm install @bkwld/light-or-dark

Usage

import { lightOrDark, isLight, isDark } from '@bkwld/light-or-dark'

lightOrDark('#000000') // "dark"
isLight('rgba(255, 255, 255)') // true
isDark('#ffffff') // false

FAQs

Package last updated on 16 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts