ApplyCSS applies css styles to given node, using key to select sub-properties from overall properties list
(sv *SVG, key string, css map[string]any)
| 355 | // ApplyCSS applies css styles to given node, |
| 356 | // using key to select sub-properties from overall properties list |
| 357 | func (g *NodeBase) ApplyCSS(sv *SVG, key string, css map[string]any) bool { |
| 358 | pp, got := css[key] |
| 359 | if !got { |
| 360 | return false |
| 361 | } |
| 362 | pmap, ok := pp.(map[string]any) // must be a properties map |
| 363 | if !ok { |
| 364 | return false |
| 365 | } |
| 366 | pc := &g.Paint |
| 367 | ctxt := colors.Context(sv) |
| 368 | if g.Parent != sv.Root.This { |
| 369 | pp := g.Parent.(Node).AsNodeBase().PaintStyle() |
| 370 | pc.SetStyleProperties(pp, pmap, ctxt) |
| 371 | } else { |
| 372 | pc.SetStyleProperties(nil, pmap, ctxt) |
| 373 | } |
| 374 | return true |
| 375 | } |
| 376 | |
| 377 | // StyleCSS applies css style properties to given SVG node |
| 378 | // parsing out type, .class, and #name selectors |
no test coverage detected