d2 icon indicating copy to clipboard operation
d2 copied to clipboard

specify icon size

Open alixander opened this issue 1 year ago • 6 comments

2 options:

  1. scale with font-size
  2. introduce a new icon-size

I suspect (1) is right

alixander avatar May 15 '23 17:05 alixander

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.

pchaganti avatar May 15 '23 20:05 pchaganti

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.

mmatti avatar May 15 '23 20:05 mmatti

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

carine-laine avatar Mar 05 '24 14:03 carine-laine

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
 }
}

bo-ku-ra avatar Mar 05 '24 16:03 bo-ku-ra

Yeah icon-size is what we should do

alixander avatar Mar 20 '24 18:03 alixander

On revisit, it should be icon.width and icon.height

alixander avatar Apr 28 '24 07:04 alixander