def rainbow(self):
if not self.items:<EOL><INDENT>return {"<STR_LIT>": "<STR_LIT>", "<STR_LIT>": self.py3.CACHE_FOREVER}<EOL><DEDENT>if time() >= self._cycle_time - (self.cycle_time / <NUM_LIT:10>):<EOL><INDENT>self.active_color = (self.active_color + <NUM_LIT:1>) % len(self.colors)<EOL>self._set_cycle_time()<EOL><DEDENT>color = self.colors[self.active_color]<EOL>content = self._get_current_output()<EOL>output = []<EOL>if content:<EOL><INDENT>step = len(self.colors) // len(content)<EOL><DEDENT>for index, item in enumerate(content):<EOL><INDENT>if self.multi_color:<EOL><INDENT>offset = (self.active_color + (index * step)) % len(self.colors)<EOL>color = self.colors[offset]<EOL><DEDENT>obj = item.copy()<EOL>if self.force or not obj.get("<STR_LIT>"):<EOL><INDENT>obj["<STR_LIT>"] = color<EOL><DEDENT>output.append(obj)<EOL><DEDENT>composites = {"<STR_LIT>": self.py3.composite_create(output)}<EOL>rainbow = self.py3.safe_format(self.format, composites)<EOL>return {"<STR_LIT>": self._cycle_time, "<STR_LIT>": rainbow}<EOL>
Make a rainbow!