css_ast/values/color/
mod.rs

1#![allow(warnings)]
2//! CSS Color Module Level 4
3//! https://drafts.csswg.org/css-color-6/
4
5mod impls;
6use impls::*;
7
8/// Represents the style value for `color` as defined in [css-color-6](https://drafts.csswg.org/css-color-6/#color).
9///
10/// The color CSS property sets the primary foreground color of an element, which is used for text, the default border color, and text decorations.
11///
12/// The grammar is defined as:
13///
14/// ```text,ignore
15/// <color>
16/// ```
17///
18// https://drafts.csswg.org/css-color-6/#color
19#[syntax(" <color> ")]
20#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
21#[style_value(
22	initial = "CanvasText",
23	applies_to = "all elements and text",
24	inherited = "yes",
25	percentages = "n/a",
26	canonical_order = "per grammar",
27	animation_type = "by computed value type"
28)]
29#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
30#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.color"))]
31#[visit]
32pub struct ColorStyleValue;
33
34/// Represents the style value for `opacity` as defined in [css-color-6](https://drafts.csswg.org/css-color-6/#opacity).
35///
36/// The opacity CSS property sets the transparency of an element.
37///
38/// The grammar is defined as:
39///
40/// ```text,ignore
41/// <opacity-value>
42/// ```
43///
44// https://drafts.csswg.org/css-color-6/#opacity
45#[syntax(" <opacity-value> ")]
46#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
47#[style_value(
48	initial = "1",
49	applies_to = "all elements",
50	inherited = "no",
51	percentages = "map to the range [0,1]",
52	canonical_order = "per grammar",
53	animation_type = "by computed value type"
54)]
55#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
56#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.opacity"))]
57#[visit]
58pub struct OpacityStyleValue;