Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boenfu/text-rgb
Create rgb tuple from a string of text
https://github.com/boenfu/text-rgb
Last synced: about 24 hours ago
JSON representation
Create rgb tuple from a string of text
- Host: GitHub
- URL: https://github.com/boenfu/text-rgb
- Owner: boenfu
- License: mit
- Created: 2024-03-16T03:26:26.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-26T15:06:40.000Z (8 months ago)
- Last Synced: 2024-08-06T11:10:41.001Z (3 months ago)
- Language: TypeScript
- Size: 110 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# text-rgb
Create rgb tuple from a string of text
## Install
```shell
npm install @beonfu/text-rgb
```## Usage
```javascript
import { rgb, rgbString, rgbaString } from '@beonfu/text-rgb'rgb('Hello World') // [133, 230, 177]
rgbString('Hello World') // "rgb(133,230,177)"
rgbaString('Hello World', 1) // "rgba(133,230,177,1)"
```The principle is to divide the text into three parts, and then take the remainder of 256 after accumulating the sum of charCode
So there is no randomness```javascript
rgbString('Hello World') === rgbString('Hello World') // true
```## Hello World RGB
In addition to the functions of the function itself, I also want to share some interesting content![hello world rgb](./hello-world-rgb.png)
## PackageName
Why use `@boenfu/text-rgb` instead of `text-rgb` ?
> npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/text-rgb - Package name too similar to existing package [textrgb](https://www.npmjs.com/package/textrgb); try renaming your package to '@boenfu/text-rgb' and publishing with 'npm publish --access=public' instead## License
[MIT](./LICENSE)