Created
June 30, 2020 13:49
-
-
Save avivajpeyi/6cafec9c0ffa70b0bd72b7ee85e995d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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