Using HTML Colour Variable in SVG/HTML Export

Sometimes I want to generate SVG/HTML that can change colour dependent on colour variables such as --var(--foreground). Currently the colour model in typst does not support this operation. This is useful for generating diagrams that can adapt to dark mode on a website, for example.

Would a PR that adds an additional case variable to color.rs be welcomed?

Contributions are welcome in general, but especially when there’s different options to implement stuff, bringing it up on Discord or as an issue (in this case a feature request) on Github is usually preferred to avoid work that in the end wouldn’t make it into the repo.

I know that color handling can get rather intricate, so some discussion first probably makes sense.

(as an aside, right now you can instead export two versions from the same file using these techniques and render conditionally in HTML using this, maybe that also helps for your use case)