Skip to content

Instantly share code, notes, and snippets.

@gbroques
Created May 17, 2026 21:03
Show Gist options
  • Select an option

  • Save gbroques/87286b67b7ee420b2c12a675dbb15426 to your computer and use it in GitHub Desktop.

Select an option

Save gbroques/87286b67b7ee420b2c12a675dbb15426 to your computer and use it in GitHub Desktop.
dark theme high contrast palette using golden ratio
unique_clusters = sorted([c for c in np.unique(clusters) if c != 'noise'], key=int)
n_cl = len(unique_clusters)
golden = (1 + 5**0.5) / 2
colors = {}
for i, c in enumerate(unique_clusters):
h = (i / golden) % 1.0
s = 0.65 + 0.3 * ((i * 7) % 3) / 2 # vary saturation
l = 0.45 + 0.15 * ((i * 13) % 3) / 2 # vary lightness
colors[c] = colorsys.hls_to_rgb(h, l, s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment