Skip to content

Commit

Permalink
add 24 colour, based on @duja's suggested colours
Browse files Browse the repository at this point in the history
  • Loading branch information
amandasaurus committed Apr 26, 2024
1 parent fe0c74c commit cfb8f06
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,17 @@ <h2 class="fs-5">Colours</h2>
>
11
</button>
<button
class="btn btn-primary"
@click="map.setPaintProperty('waterway-line', 'line-color', ['match',['%', ['get', 'root_wayid_120'], 24],
0, '#fd5500', 1, '#ffa700', 2, '#feec00', 3, '#b1ff00', 4, '#06fe59', 5, '#03ffef',
6, '#0071ff', 7, '#2a00ff', 8, '#9501ff', 9, '#ff03ff', 10, '#ff026a', 11, '#ff0102',
12, '#973401', 13, '#986500', 14, '#998d00', 15, '#6c9900', 16, '#019937', 17, '#009b8f',
18, '#01439a', 19, '#180098', 20, '#590197', 21, '#99009a', 22, '#99003f', 23, '#970101',
'black', ])"
>
24
</button>
</div>
</div>
<template id="data_age" x-data x-if="$store.tilesets_loaded">
Expand Down

2 comments on commit cfb8f06

@DujaOSM
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's me :) Thanks.
For what it's worth, N "discernible colors" are best algorithmically generated in HSL color space. If I recall correctly, those above have 12 equally spaced hues, multiplied by 2 lumination levels, and the set is converted to RGB. For more colors, also vary the saturation (more bright/more grayish). That's all pretty heuristic, but works okay with up to ~50 colors, where human eye ultimately fails. And randomization of colors also has limits, since ensuring that adjacent basins never match is quite NP-hard.

@watmildon
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used this generator for TIGERMap and it seems to do a decent job. I pulled a few colors out after generation as they conflicted with common Carto coloring.. but that could be solved by having a greyscale base layer.

Please sign in to comment.