d2
d2 copied to clipboard
specify icon size
2 options:
- scale with
font-size
- introduce a new
icon-size
I suspect (1) is right
Introducing icon-size might work better. That way you can have it independent of the font-size used for container text. There will definitely be a lot of cases where you want to be independent of the font-size.
There will definitely be a lot of cases where you want to be independent of the font-size.
↑ Bingo.
The sweet spot might be a default rendering whereby not-explicitly-sized icons inherit/scale on the basis of the parent container's font size. A specified icon-size value would then override that implicit/inherited scaling.
Adding my voice to this. Being able to scale icons independently would be a huge improvement. A way to scale them in % of their default scale size would also be cool, e.g. icon-size
and/or icon-scale
font_size_is_unnatural: "" {
icon: https://d2lang.com/img/d2_graphic.svg
# icon-width: 480
# icon-height: 480
}
witdh_and_height_are_fine: {
icon: https://d2lang.com/img/d2_graphic.svg
shape: image
width: 480
height: 480
}
or
foo{
icon{
url: https://d2lang.com/img/d2_graphic.svg
width: 480
height: 480
align: center #or text-align: center
valign: center #or vertical-align: middle
}
link{
url: https://github.com/terrastruct/d2
target: _blank
}
}
Yeah icon-size
is what we should do
On revisit, it should be icon.width
and icon.height