I've been looking for a way to keep a unified selection of colors that I can access in different projects and use with different frameworks for a while.
The idea is to define a color palette such as:
palette = {
"orange": "#ce8964",
"yellow": "#eaf27c",
"green": "#71b48d",
"blue": "#454ade"
}
Which translates to these colors:
But then instead of re-defining these tuples everytime I want to use the palette, I wanted to be able to load them from somewhere when needed with one line of code like palette = load_colors().
This would be useful since I can't remember the values of the colors I used in previous projects, so I find myself frequently searching old scripts for them.
When I load the colors, they should also change format to be understood by the framework I'm using:
In tkinter colors are hex strings:
palette["orange"] = '#ce8964'
canvas.create_line(0, 0, 100, 100, fill=palette["orange"])
In pygame they are RGB tuples:
palette["orange"] = (206, 137, 100)
pygame.draw.line(win, palette["orange"], (0, 0), (100, 100))
But I wanted to have orange be universally understood so that it can be used for any targeted framework.
Is there a way to implement a system like that?

