lightningcss/values/
mod.rs

1//! Common [CSS values](https://www.w3.org/TR/css3-values/) used across many properties.
2//!
3//! Each value provides parsing and serialization support using the [Parse](super::traits::Parse)
4//! and [ToCss](super::traits::ToCss) traits. In addition, many values support ways of manipulating
5//! them, including converting between representations and units, generating fallbacks for legacy
6//! browsers, minifying them, etc.
7//!
8//! # Example
9//!
10//! This example shows how you could parse a CSS color value, convert it to RGB, and re-serialize it.
11//! Similar patterns for parsing and serializing are possible across all value types.
12//!
13//! ```
14//! use lightningcss::{
15//!   traits::{Parse, ToCss},
16//!   values::color::CssColor,
17//!   printer::PrinterOptions
18//! };
19//!
20//! let color = CssColor::parse_string("lch(50% 75 0)").unwrap();
21//! let rgb = color.to_rgb().unwrap();
22//! assert_eq!(rgb.to_css_string(PrinterOptions::default()).unwrap(), "#e1157b");
23//! ```
24//!
25//! If you have a [cssparser::Parser](cssparser::Parser) already, you can also use the `parse` and `to_css`
26//! methods instead, rather than parsing from a string.
27
28#![deny(missing_docs)]
29
30pub mod alpha;
31pub mod angle;
32pub mod calc;
33pub mod color;
34pub mod easing;
35pub mod gradient;
36pub mod ident;
37pub mod image;
38pub mod length;
39pub mod number;
40pub mod percentage;
41pub mod position;
42pub mod ratio;
43pub mod rect;
44pub mod resolution;
45pub mod shape;
46pub mod size;
47pub mod string;
48pub mod syntax;
49pub mod time;
50pub mod url;