Skip to content

Commit

Permalink
Adding Palettable
Browse files Browse the repository at this point in the history
For #22
import palettable project, to bring palettes
  • Loading branch information
Gulix committed Jul 2, 2024
1 parent 7b3901f commit 691f960
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/colors_manager.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
from palettable import palette

_GREEK_PALETTE = [ (255,255,255), (255,246,143), (205,102,0), (139,37,0) ]
_PASTELS_PALETTE = [ (158, 194, 223), (234, 206, 235), (228, 199, 155), (175, 191, 240), (207, 211, 167), (204, 229, 240) ]
_RAINBOW_PALETTE = [ (255, 0, 24), (255, 165, 44), (255, 255, 65), (0, 128, 24), (0, 0, 249), (134, 0, 125) ]

class colorManager:
"""Simple class to manage colors when displaying the Ofelia maze. A looped list of colors."""

def __init__(self, colors = [ (169, 13, 13) ]):
def __init__(self, colors = [ (169, 13, 13) ], palettable:palette.Palette = None):
self._colors = colors
self._current_color_index = 0
# if a palettable has been transmitted, we use it
if palettable:
self._colors = [ ]
for colors in palettable.colors:
self._colors.append(( colors[0], colors[1], colors[2] ))


def get_next_color(self):

Expand Down
10 changes: 8 additions & 2 deletions src/test_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
import colors_manager as colMg
import mask
import mazePlane as plane
from palettable.colorbrewer.qualitative import Dark2_7
from palettable.cubehelix import perceptual_rainbow_16
from palettable.cubehelix import Cubehelix


colors = colMg.colorManager(colors=colMg._PASTELS_PALETTE)
#colors = colMg.colorManager(colors=colMg._PASTELS_PALETTE)
colors = colMg.colorManager(palettable=Dark2_7)
colors = colMg.colorManager(palettable=perceptual_rainbow_16)
palette = Cubehelix.make(start=0.1, rotation=-0.75, n=32)
colors = colMg.colorManager(palettable=palette)

xMax = 25
yMax = 25
Expand Down

0 comments on commit 691f960

Please sign in to comment.