Display color next to layer name

This should make it easier to disambiguate layers that are otherwise hard to tell apart.
This commit is contained in:
Chandler Swift 2024-10-19 19:05:29 -05:00
parent 1ad82c55ee
commit 26c5b56d58
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F
2 changed files with 10 additions and 1 deletions

View file

@ -218,7 +218,7 @@ function newCustomLayer(name, sourceURL, colorString) {
}), }),
}); });
li.innerHTML = ` li.innerHTML = `
<label><input type="checkbox" checked> ${name}</label> <label><input type="checkbox" checked><div class="color-badge" style="background-color: rgb(${color.join(', ')});"></div> ${name}</label>
`; `;
li.querySelector("input").addEventListener("change", function(e){ li.querySelector("input").addEventListener("change", function(e){
if (e.target.checked) { if (e.target.checked) {

View file

@ -70,6 +70,15 @@ aside summary {
font-weight: bold; font-weight: bold;
} }
.color-badge {
display: inline-block;
height: 1em;
width: 2em;
vertical-align: middle;
border: 1px #444 solid;
border-radius: 4px;
}
@media (max-width: 400px) { @media (max-width: 400px) {
.nav-open #map { .nav-open #map {
left: 100%; left: 100%;