terrastruct / d2

D2 is a modern diagram scripting language that turns text to diagrams.
https://d2lang.com
Mozilla Public License 2.0
16.55k stars 415 forks source link

CSS-like aliases for style attributes #1819

Open dunkelziffer opened 7 months ago

dunkelziffer commented 7 months ago

Maybe this is just my perception as a web developer, but CSS seems to be the most ubiquitious design system. I know the default output format for D2 is SVG, so taking over some names from SVG attributes makes sense, but I think having aliases to CSS attributes would reduce the need to consult the docs as frequently for many people.

Suggested aliases: current name alias
stroke border-color
stroke-width border-width
stroke-dash border-style
fill background-color
fill-pattern background-pattern (doesn't exist in CSS)
font font-family
font-color color
bold font-weight: bold
italic font-style: italic
underline text-decoration: underline

Some mappings are not perfect, e.g. bold/italic/underline. Maintaining this might not be worth the effort. I consider this a minor UX improvement.

abusizhishen commented 6 months ago

Maybe this is just my perception as a web developer, but CSS seems to be the most ubiquitious design system. I know the default output format for D2 is SVG, so taking over some names from SVG attributes makes sense, but I think having aliases to CSS attributes would reduce the need to consult the docs as frequently for many people.

Suggested aliases:

current name alias stroke border-color stroke-width border-width stroke-dash border-style fill background-color fill-pattern background-pattern (doesn't exist in CSS) font font-family font-color color bold font-weight: bold italic font-style: italic underline text-decoration: underline Some mappings are not perfect, e.g. bold/italic/underline. Maintaining this might not be worth the effort. I consider this a minor UX improvement.

thanks a lot, i have trouble in change container color, now it resolved