Module color

Module color 

Source
Expand description

Type-safe color definitions

Provides comprehensive color types including scales, semantic colors, and manipulation utilities.

§Examples

use rustyle_css::Color;

// Create colors in different formats
let hex_color = Color::hex("#007bff");
let rgb_color = Color::rgb(0, 123, 255);
let rgba_color = Color::rgba(0, 123, 255, 0.5);
let named_color = Color::named("blue");
let var_color = Color::var("--primary-color");

// Convert to CSS
assert_eq!(hex_color.to_css(), "#007bff");
assert_eq!(rgb_color.to_css(), "rgb(0, 123, 255)");

// Manipulate colors
let lighter = hex_color.lighten(0.2);
let darker = hex_color.darken(0.2);

Enums§

Color
Represents a CSS color with type-safe operations

Type Aliases§

ColorScale
Color scale from 50 (lightest) to 950 (darkest) Re-exported from tokens for convenience
SemanticColors
Semantic colors for UI states Re-exported from tokens for convenience