color-from-string
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

color-from-string

Zero-dependency, lightweight package to convert a given string (intended to use with user names) to a HEX color code. The library uses classic hash algorithm.

https://www.npmjs.com/package/color-from-string

Installation

npm i color-from-string

Usage

import colorFromString from 'color-from-string';

const name: string = "Sergey Klinov";

const colorCode: string = colorFromString(name);

console.log(colorCode); // #352475

Tests

npm run test

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i color-from-string

    Weekly Downloads

    1,370

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    54.5 kB

    Total Files

    33

    Last publish

    Collaborators

    • sergeyklinov