d2 icon indicating copy to clipboard operation
d2 copied to clipboard

syntax: variables

Open alixander opened this issue 3 years ago • 1 comments

E.g. have $vars.light_primary hold the hex code which you reference as background on a bunch of objects

alixander avatar Nov 16 '22 01:11 alixander

Screen Shot 2022-11-22 at 2 37 15 PM

alixander avatar Nov 22 '22 22:11 alixander

@alixander is there a sketch of a design for this? I'm very interested in the idea (I'm switching from mermaid to d2 in the documentation for https://starbeamjs.com/, and the need to represent common concepts like "invalidation" or "output" in a consistent way is the biggest hurdle so far).

I've created a very simplistic preprocessor in my own codebase for style variables, but I'd also be interested in helping with the overall design.

wycats avatar Mar 01 '23 16:03 wycats

we should have a concept of "reserved vars". e.g. for color codes to override themes.

https://github.com/terrastruct/d2/issues/1327#issuecomment-1588289466

Probably more instances of it being useful

alixander avatar Jun 13 '23 00:06 alixander