https://github.com/bkwld/light-or-dark
Return whether a hex or rgb color is light or dark
https://github.com/bkwld/light-or-dark
Last synced: 12 months ago
JSON representation
Return whether a hex or rgb color is light or dark
- Host: GitHub
- URL: https://github.com/bkwld/light-or-dark
- Owner: BKWLD
- License: mit
- Created: 2021-03-15T02:48:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-16T02:58:24.000Z (over 5 years ago)
- Last Synced: 2025-03-05T10:02:04.934Z (over 1 year ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```js
import { lightOrDark, isLight, isDark } from '@bkwld/light-or-dark'
lightOrDark('#000000') // "dark"
isLight('rgba(255, 255, 255)') // true
isDark('#ffffff') // false
```