Skip to content

Instantly share code, notes, and snippets.

@avivajpeyi
Created June 30, 2020 13:49
Show Gist options
  • Save avivajpeyi/6cafec9c0ffa70b0bd72b7ee85e995d1 to your computer and use it in GitHub Desktop.
Save avivajpeyi/6cafec9c0ffa70b0bd72b7ee85e995d1 to your computer and use it in GitHub Desktop.
from typing import List, Optional
import seaborn as sns
def get_colors(num_colors: int, alpha: Optional[float]=1) -> List[List[float]]:
"""Get a list of colorblind colors,
:param num_colors: Number of colors.
:param alpha: The transparency
:return: List of colors. Each color is a list of [r, g, b, alpha].
"""
cs = sns.color_palette(palette="colorblind", n_colors=num_colors)
cs = [list(c) for c in cs]
for i in range(len(cs)):
cs[i].append(alpha)
return cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment