-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for icon provider #1470
Comments
i prefer d2 can use variables
|
Yeah variables seem like a better more generic approach to solving this problem. |
yeah exactly, that's how it will work. $icon-host: https://icons.terrastruct.com
x: {
icon: ${icon-host}/essentials%2F226-alarm%20clock.svg
} |
>d2 foobar.d2 x->y |
It would be cleaner if the icon provider had more "indirections features" such as shortcut or path transformations in order to make it easier to use frequently used icons |
closed by 0.6.0? |
@Plawn maybe we should just alias more human-friendly urls for each icon. Or maybe an official set should be included in D2 such that LSPs can find them. Icons are core to good diagrams, and I don't think even with vars that we've reached an ideal solution yet |
that's why i proposed the
syntax |
i'm happy with vars. vars:"d2 v0.6.0" {
d2-config: {theme-id: 0; dark-theme-id: 0; pad: 0; center: false; sketch: false; layout-engine: dagre}
#-------------------------------------------------------------
# images
# https://www.irasutoya.com/ (famous japanese free image site)
#-------------------------------------------------------------
twitter:"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxvrqXBEb4N9O11rxy6fdpSdnAio1cYG0GvgjmrDeHUVyc-U2SnolR4kUseN5CPhP9vfnxKDim3PjnzlNwWlcfRMRzOItu_kl05cnBIEb_S3D5hwJkhQoKa9tgnUHEYpI3-Y0WO4jWGpiitYso-OtWROLRGwiWw01-_wVqJ6wolygvTQN_i9xj7un7njJB/s992/bluebird_fired_text.png"
#-------------------------------------------------------------
}
direction:right
t->x{style.stroke-width: 8; style.stroke: red;}
t:""{
shape:image
icon:"${twitter}"
}
x:"𝕏"{
shape:text
style.font-size: 100;
}
|
I solved it by generating a d2 with icon classes, variables is also nice Idea, I will maybe change base url to variable. sample of azure.d2 with classes
my_diagram.d2:
it would be great if we could import / include classes / styles and variables from public repo similar to plantuml what is already requested #1397 |
Add a syntax to use an icon provider in order to use a shortcun when using an url for a given icon
The text was updated successfully, but these errors were encountered: