Grimoire CSS Color Toolkit
CSS Color Module Level 4 compliant color manipulation toolkit, strictly follows CSS specifications.
Installation
# CLI tool
# Library
Quick Start
Library:
use Color;
let red = try_from_str.unwrap;
let lighter = red.lighten;
let mixed = mix;
println!; // "#800080"
CLI:
# CLI examples
Methods
| Method | Description |
|---|---|
new |
Create RGBA color from components |
from-rgb |
Create color from RGB values |
from-hsl |
Create color from HSL values |
from-hwb |
Create color from HWB values |
from-hex |
Parse hex color string |
parse |
Parse any CSS color string |
red |
Get red channel value |
green |
Get green channel value |
blue |
Get blue channel value |
alpha |
Get alpha channel value |
opacity |
Get opacity value (same as alpha) |
to-hsl |
Convert to HSL format |
to-rgba |
Convert to RGBA format |
to-hex |
Convert to hex format |
to-named |
Convert to named color if possible |
grayscale |
Convert to grayscale |
complement |
Get complement color |
invert |
Invert color |
mix |
Mix two colors |
adjust-hue |
Adjust hue by degrees |
adjust-color |
Adjust color properties by delta |
change-color |
Change color properties to absolute values |
scale-color |
Scale color properties by percentage |
rgba |
Set alpha channel |
lighten |
Increase lightness |
darken |
Decrease lightness |
saturate |
Increase saturation |
desaturate |
Decrease saturation |
opacify |
Increase opacity |
fade-in |
Increase opacity (alias for opacify) |
transparentize |
Decrease opacity |
fade-out |
Decrease opacity (alias for transparentize) |
Supports all CSS color formats: hex (#ff0000), named (red), RGB (rgb(255,0,0)), HSL (hsl(0,100%,50%)), HWB (hwb(0 0% 0%))
Features
- CSS Color Module Level 4 compliant - Strictly follows CSS specifications
- 32 color manipulation functions - All standard CSS color operations
- Multiple formats - Hex, named colors, RGB, HSL, HWB support
- Dual interface - Both CLI tool and Rust library
- Fast & reliable - Written in Rust with comprehensive tests