67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
-
+
|
"arrow <-> down from last box.s\n"
"box same \"Pikchr\" \"Formatter\" \"(pikchr.c)\" fit\n";
}
style_header("PikchrShow");
CX("<style>");
CX("div.content { padding-top: 0.5em }");
CX("#sbs-wrapper {"
"display: flex; flex-direction: row; flex-wrap: wrap;"
"display: flex; flex-direction: column;"
"}");
CX("#sbs-wrapper > * {"
"margin: 0 0.25em 0.5em 0; flex: 1 10 auto;"
"align-self: stretch;"
"}");
CX("#sbs-wrapper textarea {"
"max-width: initial; flex: 1 1 auto;"
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
-
+
+
+
-
-
|
"}");
CX("#pikchrshow-controls > * {"
"display: inline; margin: 0 0.25em 0.5em 0;"
"}");
CX("#pikchrshow-controls > .input-with-label > * {"
"cursor: pointer;"
"}");
CX("#pikchrshow-output.dark-mode > svg {"
CX("#pikchrshow-output.dark-mode svg {"
/* Flip the colors to approximate a dark theme look */
"filter: invert(1) hue-rotate(180deg);"
"}");
CX("#sbs-wrapper > fieldset {"
"padding: 0.25em 0.5em; border-radius: 0.25em;"
"}");
CX("fieldset > legend > .copy-button {margin-left: 0.25em}");
CX("</style>");
CX("<div>Input pikchr code and tap Preview to render it:</div>");
CX("<div id='sbs-wrapper'>");
CX("<div id='pikchrshow-form'>");
CX("<textarea id='content' name='content' rows='15'>%s</textarea>",
zContent/*safe-for-%s*/);
CX("<div id='pikchrshow-controls'>");
CX("<button id='pikchr-submit-preview'>Preview</button>");
style_labeled_checkbox("flipcolors-wrapper", "flipcolors",
"Simulate dark theme?",
"1", flipColors, 0);
CX("</div>"/*#pikchrshow-controls*/);
CX("<textarea id='content' name='content' rows='15'>%s</textarea>",
zContent/*safe-for-%s*/);
CX("</div>"/*#pikchrshow-form*/);
CX("<fieldset id='pikchrshow-output-wrapper'>");
CX("<legend>Preview <span class='copy-button'></span></legend>");
CX("<div id='pikchrshow-output'>");
if(*zContent){
int w = 0, h = 0;
char *zOut = pikchr(zContent, "pikchr", 0, &w, &h);
|