sklinov / color-from-string

Convert string to HEX color code

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Convert string to HEX color code

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


Languages

Language:JavaScript 45.5%Language:CSS 27.2%Language:HTML 19.0%Language:TypeScript 8.3%