MCPcopy Create free account
hub / github.com/csskit/csskit / to_css

Method to_css

crates/csskit_transform/src/reduce_colors.rs:144–165  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

142
143impl ToCss for chromashift::Color {
144 fn to_css(&self) -> Option<String> {
145 match self {
146 chromashift::Color::Lab(c) => c.to_css(),
147 chromashift::Color::Lch(c) => c.to_css(),
148 chromashift::Color::Oklab(c) => c.to_css(),
149 chromashift::Color::Oklch(c) => c.to_css(),
150 chromashift::Color::Hsl(c) => c.to_css(),
151 chromashift::Color::Hwb(c) => c.to_css(),
152 chromashift::Color::DisplayP3(c) => c.to_css(),
153 chromashift::Color::LinearRgb(c) => c.to_css(),
154 chromashift::Color::A98Rgb(c) => c.to_css(),
155 chromashift::Color::ProphotoRgb(c) => c.to_css(),
156 chromashift::Color::Rec2020(c) => c.to_css(),
157 chromashift::Color::XyzD50(c) => c.to_css(),
158 chromashift::Color::XyzD65(c) => c.to_css(),
159 // sRGB types don't need native-space CSS — they use Shortest
160 chromashift::Color::Hex(_)
161 | chromashift::Color::Named(_)
162 | chromashift::Color::Srgb(_)
163 | chromashift::Color::Hsv(_) => None,
164 }
165 }
166}
167
168#[visitor]

Callers 2

visit_colorMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected