# Store color palettes and make them accessible through several
# methods, especially byt randomly picking one
# CAC, 3/13/23
#
import random

palettes = {
    "Viridis (4)" : ['#fde725','#35b779','#31688e','#440154'],
    'Tol Dark (6)': ['#222255', '#225555', '#225522', '#666633', '#663333', '#555555'],
    "Hope College (6)": ['#F46A1F', '#002244', '#F7E654', '#BED600', '#00685B', '#00B0CA'],
    "Grayscale (7)": ['#FFFFFF', '#D5D5D5', '#AAAAAA', '#808080', '#555555', '#2A2A2A', '#000000'],

}
paletteList = list(palettes.items())

def getPalette(name):
    """
    Returns the colors of the palette of the given name,
    or None if there is no such palette.
    Returns a copy of the internal color array stored here.
    :param name:
    :return:
    """
    if name in palettes:
        return palettes.get(name).copy()
    else:
        return None

def randomNamedPalette():
    """
    Returns a random palette along with its name,
    with the name being first and the list of colors second.
    Returns a copy of the internal color array stored here.
    :return:
    """
    n,c=random.choice(paletteList)
    return n,c.copy()

def randomPalette():
    """
    :return:
    returns the colors of a random palette from the list.
    Does not return the name.
    Returns a copy of the internal color array stored here.
    """
    return random.choice(paletteList)[1].copy()
