# Stores color palettes and make them accessible through several
# methods, especially by randomly picking one
# CAC, 8/5/24
#
import random

palettes = {
    # Add more palettes here if you wish.
    # Make sure you follow the syntax below and include
    # a comma between each palette.
    # The syntax of each entry is:
    # "PALLET_NAME" : [COLOR0,COLOR1,...COLORn],
    # Where COLORi needs to be in quotes if it is a name or hex code.
    #

    "Hope College (9)" : ['#F46A1F','#002244','#91420E','#F0AB00','#F7E654','#BED600','#00685B','#5482AB','#00B0CA'],
    # I created based on images from the RFQ
    "GFIAA (6)": ["#dadedd", "#3a4a39", "#7c782f", "#6f899e", "#604c35", "#967e6d"],
    # from https://www.pinterest.com/pin/419608890287849018/
    "Autumn Melancholy (5)": ['#d0c589', '#ca8441', '#e26815', '#404116', '#359e7f'],
    "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()
