Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvain-Rama authored Nov 30, 2023
1 parent 0f31b72 commit 3b2d346
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Chatoyant.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def roll(self, n=1):
name = self.name + f"-rolled_{n}"
color_map = self.color_map
rolled = color_map[-n:] + color_map[:-n]

return ColorMap(color_map=rolled, name=name)

def extend(self, n=10):
Expand Down Expand Up @@ -236,7 +237,7 @@ def map_to_index(self, idxs):

colors = [self.color_map[i] for i in indexes]

return colors
return ColorMap(color_map=colors, name=self.name+'-indexed')

def set_name(self, name=None):
# Set the name of the ColorMap. Cosmetic only.
Expand Down Expand Up @@ -300,6 +301,6 @@ def name(self):
return self.name

if __name__ == '__main__':
cmap = ColorMap().from_matplotlib('viridis', n=512)
cmap = ColorMap().from_matplotlib('viridis', n=12)

print(cmap)

0 comments on commit 3b2d346

Please sign in to comment.