Skip to content

Commit 73d16a9

Browse files
authored
Update README.md
1 parent b3fe35b commit 73d16a9

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

README.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,39 @@
1-
<p align="center">
1+
# String to Color
22

3-
# String to color
4-
5-
A library to convert any string to hex color
3+
String to Color is a simple library that allows you to convert any string into a corresponding hexadecimal color value.
64

75
## Installation
86

9-
npm i @rtcoder/string-to-color
7+
To install the library, use the following command:
8+
9+
```bash
10+
npm i @rtcoder/string-to-color
11+
```
1012

1113
## Usage
1214

13-
import {stringToColor} from "@rtcoder/string-to-color";
15+
Import the `stringToColor` function from `@rtcoder/string-to-color` in your JavaScript file:
16+
17+
```javascript
18+
import { stringToColor } from "@rtcoder/string-to-color";
19+
```
20+
21+
Use the `stringToColor` function to convert your string into a color:
1422

15-
const color = stringToColor('Lorem ipsum dolor sit amet');
23+
```javascript
24+
const color = stringToColor('Lorem ipsum dolor sit amet');
25+
```
26+
27+
The `color` variable will now hold a hexadecimal color value based on the input string.
1628

1729
## Interface
1830

19-
function stringToColor(str: string): string;
20-
</p>
31+
The library provides the following interface:
32+
33+
```typescript
34+
function stringToColor(str: string): string;
35+
```
36+
37+
The `stringToColor` function takes a string as input and returns a corresponding hexadecimal color value.
38+
39+
Feel free to use this library to add some visual representation based on strings in your projects.

0 commit comments

Comments
 (0)