Skip to content

Commit 84a323f

Browse files
committed
Add color scheme to demo page
1 parent 0b76161 commit 84a323f

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

website/templates/pages/demo/content.handlebars

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</div>
3434

3535
<div class="columns is-desktop is-multiline">
36-
<div class="column is-one-fifth-widescreen">
36+
<div class="column is-one-sixth-widescreen">
3737
<label title="Output format of the HTML, either line by line or side by side">
3838
<p>Output Format</p>
3939
<select class="options-label-value" id="diff-url-options-output-format" name="outputFormat">
@@ -42,14 +42,24 @@
4242
</select>
4343
</label>
4444
</div>
45-
<div class="column is-one-fifth-widescreen">
45+
<div class="column is-one-sixth-widescreen">
46+
<label title="Color scheme to render. Auto uses user preference.">
47+
<p>Color Scheme</p>
48+
<select class="options-label-value" id="diff-url-options-color-scheme" name="colorScheme">
49+
<option value="light" selected>Light</option>
50+
<option value="dark">Dark</option>
51+
<option value="auto">Auto</option>
52+
</select>
53+
</label>
54+
</div>
55+
<div class="column is-one-sixth-widescreen">
4656
<label title="Show the file list summary before the diff">
4757
<p>File Summary</p>
4858
<input class="options-label-value" id="diff-url-options-show-files" type="checkbox" name="drawFileList"
4959
checked />
5060
</label>
5161
</div>
52-
<div class="column is-one-fifth-widescreen">
62+
<div class="column is-one-sixth-widescreen">
5363
<label title="Level of matching for the comparison algorithm">
5464
<p>Matching Type</p>
5565
<select class="options-label-value" id="diff-url-options-matching" name="matching">
@@ -59,14 +69,14 @@
5969
</select>
6070
</label>
6171
</div>
62-
<div class="column is-one-fifth-widescreen">
72+
<div class="column is-one-sixth-widescreen">
6373
<label title="Similarity threshold for the matching algorithm">
6474
<p>Words Threshold</p>
6575
<input class="options-label-value" id="diff-url-options-match-words-threshold" type="number"
6676
name="matchWordsThreshold" value="0.25" step="0.05" min="0" max="1" />
6777
</label>
6878
</div>
69-
<div class="column is-one-fifth-widescreen">
79+
<div class="column is-one-sixth-widescreen">
7080
<label title="Maximum number of comparison performed by the matching algorithm in a block of changes">
7181
<p>Max Comparisons</p>
7282
<input class="options-label-value" id="diff-url-options-matching-max-comparisons" type="number"
@@ -134,4 +144,4 @@
134144
providing better diff support for existing online services.
135145
</p>
136146
</div>
137-
</section>
147+
</section>

website/templates/pages/demo/demo.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ type Elements = {
200200
};
201201
options: {
202202
outputFormat: HTMLInputElement;
203+
colorScheme: HTMLInputElement;
203204
matching: HTMLInputElement;
204205
wordsThreshold: HTMLInputElement;
205206
matchingMaxComparisons: HTMLInputElement;
@@ -259,6 +260,7 @@ document.addEventListener('DOMContentLoaded', async () => {
259260
},
260261
options: {
261262
outputFormat: getHTMLInputElementById('diff-url-options-output-format'),
263+
colorScheme: getHTMLInputElementById('diff-url-options-color-scheme'),
262264
matching: getHTMLInputElementById('diff-url-options-matching'),
263265
wordsThreshold: getHTMLInputElementById('diff-url-options-match-words-threshold'),
264266
matchingMaxComparisons: getHTMLInputElementById('diff-url-options-matching-max-comparisons'),
@@ -272,6 +274,7 @@ document.addEventListener('DOMContentLoaded', async () => {
272274

273275
// Update HTML inputs from any changes in URL
274276
config.outputFormat && (elements.options.outputFormat.value = config.outputFormat);
277+
config.colorScheme && (elements.options.colorScheme.value = config.colorScheme);
275278
config.drawFileList && (elements.checkboxes.drawFileList.checked = config.drawFileList);
276279
config.matching && (elements.options.matching.value = config.matching);
277280
config.matchWordsThreshold && (elements.options.wordsThreshold.value = config.matchWordsThreshold.toString());

0 commit comments

Comments
 (0)