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

Method visit_color

crates/csskit_highlight/src/css.rs:140–149  ·  view source on GitHub ↗

Visit Color nodes to decorate with the swatch

(&mut self, color: &Color)

Source from the content-addressed store, hash-verified

138
139 // Visit Color nodes to decorate with the swatch
140 fn visit_color(&mut self, color: &Color) {
141 let metadata = color.metadata();
142 let modifier = SemanticModifier::from(&metadata);
143 if let Some(bg) = color.to_chromashift() {
144 let swatch = SemanticDecoration::BackgroundColor(bg.into());
145 self.insert_with_decoration(color.to_span(), SemanticKind::StyleValueColor, modifier, swatch);
146 } else {
147 self.insert(color.to_span(), SemanticKind::StyleValueColor, modifier);
148 }
149 }
150
151 // Special case: CSSInt doesn't implement QueryableNode (has visit(skip))
152 fn visit_css_int(&mut self, int: &CSSInt) {

Callers

nothing calls this directly

Calls 5

metadataMethod · 0.45
to_chromashiftMethod · 0.45
to_spanMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected