question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Having trouble adding colors to the map

See original GitHub issue

Hi, thank you very much for this library. I am trying to add colors to my web gl. I have prepared an array of colors the same length as the array of points, with in RGB hexadecimal format.

This is the format:

[["#762181"],["#762181"],["#6E1E81"],["#170F3C"],["#170F3C"],["#420F75"],["#661B80"],["#AE347B"],["#420F75"],["#420F75"]]

I save this as map_colors and call it in L.glify.points as below:

L.glify.points({
  map: mymap,
  data: array,
  color: map_colors
});

However, the points do not seem to be changing color, they are all grey. Do I need to provide the colors in a different format? Thank you

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
robertleeplummerjrcommented, Dec 4, 2018

Also, if hexadecimal is of value, we could easily put in a translator.

1reaction
Jesse-Kerrcommented, Dec 4, 2018

Hi Tim,

Thank you for the help. I converted my hexadecimal colors into RGB format and divided by 255, so they look like so:

var color_min = 
[[0.462745098039216,0.129411764705882,0.505882352941176],
[0.431372549019608,0.117647058823529,0.505882352941176],
[0.0901960784313725,0.0588235294117647,0.235294117647059]]; 

The data points I have look like this:

var arr_min =
[[0.462745098039216,0.129411764705882,0.505882352941176],
[0.462745098039216,0.129411764705882,0.505882352941176],
[0.431372549019608,0.117647058823529,0.505882352941176]]

Then I followed your example on the link you provided, and now have this:

var clrs;
if (color_min.length === 1) {
	clrs = color_min[0];
} else {
	clrs = function(index, point) { return color_min[index]; };

}

L.glify.points({
  map: mymap,
  data: arr_min,
  color: clrs
});

However, my points are still all coming out grey.

Thank you again, Jesse

Read more comments on GitHub >

github_iconTop Results From Across the Web

Four color theorem - Wikipedia
In mathematics, the four color theorem, or the four color map theorem, states that no more than four colors are required to color...
Read more >
How To Change The Names And Colors Of Items On Your Map
This video goes over the different options you have for changing the ... colors of items from your feature palette that you've added...
Read more >
Changing Colors on Maps - YouTube
Use the tools in Adobe Illustrator to edit colors on Map Resources maps.
Read more >
Bootstrap 5 won't allow me to add additional colors to the map
I'm not sure what you have in _custom, but the $custom-colors map you've created should work fine to generate the additional colors.
Read more >
Use map layers - Computer - My Maps Help - Google Support
Make sure there's no info in fields the destination layer doesn't have. ... Open data table. Edit line, shape or place info: Edit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found