Skip to content

Commit a562793

Browse files
committed
change colors
1 parent 9a92f7f commit a562793

3 files changed

Lines changed: 23 additions & 30 deletions

File tree

www/main/settings/options/options.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,32 +75,32 @@ <h2 class="text-strong">Other</h2>
7575
</div>
7676
</div>
7777
</div>
78-
<div class="item">
78+
<div class="item" id="colors-list">
7979
<h2 class="text-strong">Feature colors <i class="icon ion-information-circled"
8080
onclick="openPopover('popoverColors')"></i></h2>
8181
<div class="item">
8282
<label for="blackCheckbox">Black</label>
8383
<div class="right"><input type="checkbox" id="blackCheckbox" value="black"></div>
8484
</div>
8585
<div class="item">
86-
<label for="greenCheckbox">Green</label>
87-
<div class="right"><input type="checkbox" id="greenCheckbox" value="green"></div>
86+
<label for="olivedrabCheckbox">Green</label>
87+
<div class="right"><input type="checkbox" id="olivedrabCheckbox" value="olivedrab"></div>
8888
</div>
8989
<div class="item">
90-
<label for="yellowCheckbox">Yellow</label>
91-
<div class="right"><input type="checkbox" id="yellowCheckbox" value="yellow"></div>
90+
<label for="goldCheckbox">Yellow</label>
91+
<div class="right"><input type="checkbox" id="goldCheckbox" value="gold"></div>
9292
</div>
9393
<div class="item">
94-
<label for="redCheckbox">Red</label>
95-
<div class="right"><input type="checkbox" id="redCheckbox" value="red"></div>
94+
<label for="firebrickCheckbox">Red</label>
95+
<div class="right"><input type="checkbox" id="firebrickCheckbox" value="firebrick"></div>
9696
</div>
9797
<div class="item">
98-
<label for="blueCheckbox">Blue</label>
99-
<div class="right"><input type="checkbox" id="blueCheckbox" value="blue"></div>
98+
<label for="dodgerblueCheckbox">Blue</label>
99+
<div class="right"><input type="checkbox" id="dodgerblueCheckbox" value="blue"></div>
100100
</div>
101101
<div class="item">
102-
<label for="brownCheckbox">Brown</label>
103-
<div class="right"><input type="checkbox" id="brownCheckbox" value="brown"></div>
102+
<label for="saddlebrownCheckbox">Brown</label>
103+
<div class="right"><input type="checkbox" id="saddlebrownCheckbox" value="saddlebrown"></div>
104104
</div>
105105
</div>
106106
</div>

www/main/settings/options/options.js

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { getOptions, getLayers } from '../utils';
22

33
export async function onLoadOptions() {
44

5-
let defColors = ["black", "green", "yellow", "red", "blue", "brown"];
65
let options = await getOptions();
76
let layers = await getLayers();
87

@@ -45,20 +44,18 @@ export async function onLoadOptions() {
4544
document.getElementById('groupColorCheckbox').addEventListener('click', checkColorBtn);
4645
document.getElementById('colorbarCheckbox').addEventListener('click', checkColorBtn);
4746

48-
let colorsAdded = defColors.map(e => {
49-
if (options.colors.includes(e)) {
50-
return document.getElementById(`${e}Checkbox`);
51-
}
47+
let colorsAdded = options.colors.map(e => {
48+
return document.getElementById(`${e}Checkbox`);
5249
});
53-
colorsAdded.filter(el => el != null).forEach(e => { e.checked = true });
50+
colorsAdded.forEach(e => { e.checked = true });
5451

5552
let form = document.getElementById("formoptions");
5653
if (form) {
57-
[...form.elements].forEach(e => e.addEventListener('input', (ev) => { onChange(ev, options, defColors) }))
54+
[...form.elements].forEach(e => e.addEventListener('input', (ev) => { onChange(ev, options) }))
5855
}
5956
}
6057

61-
async function onChange(ev, options, defColors) {
58+
async function onChange(ev, options) {
6259

6360
ev.preventDefault();
6461

@@ -86,16 +83,12 @@ async function onChange(ev, options, defColors) {
8683
break
8784
}
8885

89-
if (defColors) {
90-
91-
let colorCheckboxes = defColors.map(e => document.getElementById(`${e}Checkbox`));
92-
let colorsNew = colorCheckboxes.map(e => {
93-
if (e.checked) { return e.value }
94-
})
95-
options.colors = colorsNew.filter(el => el != null);
96-
app.properties.color = options.colors[0];
97-
98-
}
86+
let colorCheckboxes = document.getElementById('colors-list').querySelectorAll('input[type="checkbox"]');
87+
let colorsNew = [...colorCheckboxes].map(e => {
88+
if (e.checked) { return e.value }
89+
})
90+
options.colors = colorsNew.filter(el => el != null);
91+
app.properties.color = options.colors[0];
9992

10093
if (document.getElementById('groupCheckbox').checked) {
10194
options.groupType = document.getElementById('groupTypeCheckbox').checked;

www/main/settings/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function getOptions() {
4848

4949
return (options ? JSON.parse(options) : {
5050
colorbar: true,
51-
colors: ["black", "green", "yellow", "red", "blue", "brown"],
51+
colors: ["black", "olivedrab", "gold", "firebrick", "dodgerblue", "saddlebrown"],
5252
location: true,
5353
comments: true,
5454
cache: true,

0 commit comments

Comments
 (0)