https://github.com/ianfabs/cs-rcg
A small, and fast random color generator. Generates hex, hsl, hsla, rgb, and rgba colors (and also hex-alpha).
https://github.com/ianfabs/cs-rcg
cli colors deno javascript node rgba typescript
Last synced: 3 months ago
JSON representation
A small, and fast random color generator. Generates hex, hsl, hsla, rgb, and rgba colors (and also hex-alpha).
- Host: GitHub
- URL: https://github.com/ianfabs/cs-rcg
- Owner: ianfabs
- Created: 2020-02-04T06:33:35.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-19T23:39:59.000Z (over 5 years ago)
- Last Synced: 2025-06-22T18:03:43.633Z (about 1 year ago)
- Topics: cli, colors, deno, javascript, node, rgba, typescript
- Language: TypeScript
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://gitpod.io/#https://github.com/ianfabs/rcg) 
# CS-RCG
#### *Cryptographically-Secure Random Color Generator*
A tiny, and fast random color generator. Generates hex, rgb, and hsl colors (Optionally with alpha-values). I got the idea from my implementation of nanoid for Deno. The way the random values are generated ensures (mostly) true randomness. I also like using/learning new Web APIs, and Web Crypto is pretty cool.
# Usage
## Code
```ts
import {hex, rgb, hsl} from "https://deno.land/x/cs-rcg/mod.ts";
hex() // 1b69af
hex(true) // 1b69af91
rgb() // [12, 102, 67]
rgb(true) // [12, 102, 67, 0.32]
hsl() // [217, 48.12, 91.55]
hsl(true) // [217, 48.12%, 91.55%, 0.78]
// You get the idea...
```
## CLI
RCG offers a simple cli for generating colors too.
### Installation
```sh
$ deno install --allow-read --name rcg https://deno.land/x/cs-rcg/cli.ts
```
### Usage
```sh
$ rcg
3c5f67
```
```sh
$ rcg hsl -fa
hsl(161, 28%, 71%, 0.53)
```