Skip to content

mybuddymichael/cast

Repository files navigation

cast

A tiny command line utility that converts colors from one format to another.

Usage examples

cast "#ff0000" --to-hsl                  # -> hsl(0, 100%, 50%)
cast "oklch(1.000 0.000 0)" --to-rgb     # -> rgb(255, 255, 255)
cast "rgba(0, 0, 255, 0.7)" --to-oklch   # -> oklch(45.201% 0.31321 264.05 / 0.7)
cast "hsb(208 50% 100%)" --to-hsl        # -> hsl(208, 50%, 75%)

Installation and usage

Use without installing

bunx @hnsn/cast "<color>" [--to-rgb | --to-hsl | --to-hsv | --to-hsb | --to-hwb | --to-oklab | --to-oklch]

Or with npx:

npx @hnsn/cast "<color>" [--to-rgb | --to-hsl | --to-hsv | --to-hsb | --to-hwb | --to-oklab | --to-oklch]

Install via npm

bun add -g @hnsn/cast
cast "<color>" [--to-rgb | --to-hsl | --to-hsv | --to-hsb | --to-hwb | --to-oklab | --to-oklch]
npm install -g @hnsn/cast
cast "<color>" [--to-rgb | --to-hsl | --to-hsv | --to-hsb | --to-hwb | --to-oklab | --to-oklch]

Homebrew

brew install mybuddymichael/tap/cast
cast "<color>" [--to-rgb | --to-hsl | --to-hsv | --to-hsb | --to-hwb | --to-oklab | --to-oklch]

Using from LLMs

Put something like this in your prompt to help LLMs convert colors:

Use the `cast` command to convert colors from one format to another.
Run `cast --help` for usage and a list of supported formats.

Note

If you are using this tool with your LLM, I recommend you install it first (and not use it with bunx or npx) so that you have a known-safe and pristine copy on your device.

Help and documentation

Run cast --help for a list of supported formats.

Development

To install dependencies:

bun install

To run:

bun run index.ts <color> <output format>

Conversion backend

This utilizes color.js to convert colors.

About

A tiny command line utility that converts colors from one format to another.

Resources

License

Stars

Watchers

Forks

Packages

No packages published