From 3b2d3466510d9f0cf723d894858aa5fdbbee9a94 Mon Sep 17 00:00:00 2001 From: Sylvain <60986961+Sylvain-Deposit@users.noreply.github.com> Date: Thu, 30 Nov 2023 09:10:57 +0000 Subject: [PATCH] Add files via upload --- Chatoyant.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Chatoyant.py b/Chatoyant.py index 5e29596..e095ce1 100644 --- a/Chatoyant.py +++ b/Chatoyant.py @@ -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): @@ -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. @@ -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) \ No newline at end of file