@boenfu/text-rgb
v0.1.0
Published
Create rgb tuple from a string of text
Downloads
3
Readme
text-rgb
Create rgb tuple from a string of text
Install
npm install @beonfu/text-rgb
Usage
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
rgb('Hello World') === rgb('Hello World') // true
Hello World RGB
In addition to the functions of the function itself, I also want to share some interesting content
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; try renaming your package to '@boenfu/text-rgb' and publishing with 'npm publish --access=public' instead
License
MIT