@jeact/contrast-color
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

@jeact/contrast-color

Jeact Logo

NPM Travis (.com) Libraries.io dependency status for latest release npm npm bundle size npm GitHub Repo stars

Simple function to get the contrast color for a text over some color.

Instalation

npm i @jeact/contrast-color

How to use

Import the function from the module and then use it providing a valid color, the function will return either "#ffffff" for dark colors and "#000000" for bright colors, this represents a good color for the text that makes a good contrast.

import contrastColor from '@jeact/contrast-color'

const backgroundColor = "#dd0000"
const textColor = contrastColor(backgroundColor)

/@jeact/contrast-color/

    Package Sidebar

    Install

    npm i @jeact/contrast-color

    Weekly Downloads

    14

    Version

    1.1.1

    License

    ISC

    Unpacked Size

    10.4 kB

    Total Files

    20

    Last publish

    Collaborators

    • jebbarbas