Skip to content

rtcoder/string-to-color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

String to Color

String to Color is a simple library that allows you to convert any string into a corresponding hexadecimal color value.

Installation

To install the library, use the following command:

npm i @rtcoder/string-to-color

Usage

Import the stringToColor function from @rtcoder/string-to-color in your JavaScript file:

import { stringToColor } from "@rtcoder/string-to-color";

Use the stringToColor function to convert your string into a color:

const color = stringToColor('Lorem ipsum dolor sit amet');

The color variable will now hold a hexadecimal color value based on the input string.

Interface

The library provides the following interface:

function stringToColor(str: string): string;

The stringToColor function takes a string as input and returns a corresponding hexadecimal color value.

Feel free to use this library to add some visual representation based on strings in your projects.