Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hex-contrast-color

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hex-contrast-color

Return a contrasting hex text color for a specific hex background color

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
457
decreased by-40.03%
Maintainers
1
Weekly downloads
 
Created
Source

hex-contrast-color

Javascript utility for getting a contrasting hex color string (#ffffff or #000000) based on a supplied hex color string.

The function accepts full 6 character strings and 3 character shorthand strings. Returns null if supplied value is not a correct hex color string.

Node

Install

npm install --save hex-contrast-color
var hexContrastColor = require('hex-contrast-color');

hexContrastColor('#000000')
> '#ffffff'
hexContrastColor('#ffffff')
> '#000000'
hexContrastColor('#f00')
> '#ffffff'

// Returns null if supplied value is not a correct hex color string
hexContrastColor(123);
> null
hexContrastColor(null);
> null

FAQs

Package last updated on 30 Jun 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc