1.0.1 • Published 3 months ago

closest_websafe v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

closest_websafe

Description:

The Node.js package finds the closest websafe color based on a hexadecimal value.

Install:

npm install closest_websafe

Usage:

The module expects a string containing a hexadecimal color and returns the nearest websafe hex string to the input as a string.

const hex2websafe = require('closest_websafe');
let notWebsafeColor = "#DECADE";
let websafeColor = hex2websafe(notWebsafeColor);
// websafeColor now contains '#884444'

Notes:

  • Invalid input will throw an error message
  • Library uses a linear searching algorithm.
  • Self-contained, needs no dependencies.

License:

ISC

1.0.1

3 months ago

1.0.0

3 months ago