@@ -4,7 +4,7 @@ title: Diagram All The Things
4
4
5
5
## Strategies
6
6
7
- ### inline svg
7
+ ### inline
8
8
9
9
- ** pros**
10
10
- interactivity
@@ -15,7 +15,7 @@ title: Diagram All The Things
15
15
- dark theme
16
16
- class based
17
17
- ` prefers-color-scheme `
18
- - allows to add dark theme to tools that don't support it out of box (` graphviz ` , ` vizdom ` , ` gnuplot ` )
18
+ - allows to add dark theme to tools that don't support it out of the box (` graphviz ` , ` vizdom ` , ` gnuplot ` )
19
19
- ** cons**
20
20
- CSS conflicts
21
21
- CSS from website can affect diagram
@@ -27,7 +27,7 @@ title: Diagram All The Things
27
27
- DOM footprint
28
28
- easy to integrate, especially if there is no inline CSS in SVG
29
29
30
- ### img with data-uri
30
+ ### data-url
31
31
32
32
- ** pros**
33
33
- no CSS conflicts
@@ -40,7 +40,7 @@ title: Diagram All The Things
40
40
- no DOM footprint, but overall weight of HTML is high as in previous strategy
41
41
- easy to integrate - only need to add a bit of CSS to support dark theme
42
42
43
- ### img external
43
+ ### file
44
44
45
45
- ** pros**
46
46
- no CSS conflicts
@@ -53,3 +53,101 @@ title: Diagram All The Things
53
53
- no interactivity
54
54
- some tools don't support dark theme out of the box (` graphviz ` , ` vizdom ` , ` gnuplot ` )
55
55
- harder to integrate - need to resolve where to write file, how to do cache busting...
56
+
57
+ ---
58
+
59
+ # TODO
60
+
61
+ ## Strategy
62
+
63
+ ### ` inline `
64
+
65
+ ** Default strategy** .
66
+
67
+ ``` html
68
+ <figure class =" beoe" ><svg >...</svg ></figure >
69
+ ```
70
+
71
+ ### ` data-url `
72
+
73
+ ``` html
74
+ <figure class =" beoe" >
75
+ <img src =" data:image/svg+xml,..." width =" ..." height =" ..." alt =" ..." />
76
+ </figure >
77
+ ```
78
+
79
+ ### ` file `
80
+
81
+ ``` html
82
+ <figure class =" beoe" >
83
+ <img src =" /path/to.svg" width =" ..." height =" ..." alt =" ..." />
84
+ </figure >
85
+ ```
86
+
87
+ ## Dark scheme
88
+
89
+ ### none
90
+
91
+ ** Default** .
92
+
93
+ ``` html
94
+ <figure class =" beoe" >only one image</figure >
95
+ ```
96
+
97
+ ### ` class `
98
+
99
+ ``` html
100
+ <figure class =" beoe" >
101
+ <div >
102
+ <img class =" beoe-light" src =" ..." />
103
+ <img class =" beoe-dark" src =" ..." />
104
+ </div >
105
+ </figure >
106
+ ```
107
+
108
+ You would need to add CSS, something like this
109
+
110
+ ``` CSS
111
+ html [data-theme = " light" ] .beoe-dark {
112
+ display : none ;
113
+ }
114
+
115
+ html [data-theme = " dark" ] .beoe-light {
116
+ display : none ;
117
+ }
118
+ ```
119
+
120
+ ### ` media `
121
+
122
+ ``` html
123
+ <figure class =" beoe" >
124
+ <picture >
125
+ <img src =" ..." />
126
+ <source media =" (prefers-color-scheme: dark)" src =" ..." />
127
+ </picture >
128
+ </figure >
129
+ ```
130
+
131
+ ## Strategy vs dark scheme
132
+
133
+ | | ` class ` | ` media ` |
134
+ | ---------- | ------- | ------- |
135
+ | ` inline ` | maybe | no |
136
+ | ` data-url ` | yes | yes |
137
+ | ` file ` | yes | yes |
138
+
139
+ ## Strategy pros and cons
140
+
141
+ | | ` inline ` | ` data-url ` | ` file ` |
142
+ | ---------------------- | ------------ | ---------- | ------ |
143
+ | Interactivity | possible | no | no |
144
+ | CSS conflicts | probably yes | no | no |
145
+ | Can be styled with CSS | yes | no | no |
146
+ | DOM footprint | high | low | low |
147
+ | HTML footprint | high | high | low |
148
+
149
+ ## Interactivity
150
+
151
+ - Links (` <a href="..."> ` )
152
+ - Search text in the diagram (<Kbd >Cmd</kbd > + <Kbd >F</kbd >)
153
+ - With JS, for example, if we inline JSON data
0 commit comments