How would I go about changing the styling for Individual entries in Leaflets layer control?

For example I would like to change the colour of "Layer 1" to red and the colour of "Layer 2" to blue.

Would this be done through the Javascript or the CSS?

enter image description here

L.control.layers({}, {
  "<span style='color:red'>Layer 1</span>": layer1,
  "<span style='color:blue'>Layer 2</span>": layer2,
  // etc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.