Skip to content

ColorsGenerator never returns random colors #930

@artygo8

Description

@artygo8

Describe the bug

ColorsGenerator never actually returns random colors.

Traceback (most recent call last):
  File "/home/arthurgossuin/code/gempy/z.py", line 6, in <module>
    next(color_iterator)
  File "/home/arthurgossuin/code/gempy/gempy/core/color_generator.py", line 69, in __next__
    result = self.hex_colors[self._index]
             ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
IndexError: list index out of range

To Reproduce

Here is the content of the file used to produce the bug:

import gempy as gp

color_iterator = gp.ColorsGenerator()

for color in range(len(color_iterator.hex_colors) + 1):
    next(color_iterator)

Expected behavior

The code seems to imply that we should fall back on random colors once there are no colors left in hex_colors.

Screenshots

pass

Desktop (please complete the following information):

  • OS: irrelevant
  • GemPy Version

Additional context

As an ex geology student, and now fulltime software developer, I was intrigued by the library and started browsing the files when I found that bug. I would be happy to contribute further if you are open to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions