Skip to content

Commit f2d7fd4

Browse files
authored
Merge pull request #107 from priestbh/main
Update comet.py to include a background color
2 parents 5e3a68c + 85e4d6e commit f2d7fd4

File tree

1 file changed

+3
-1
lines changed
  • adafruit_led_animation/animation

1 file changed

+3
-1
lines changed

adafruit_led_animation/animation/comet.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def __init__(
5151
pixel_object,
5252
speed,
5353
color,
54+
background_color=BLACK,
5455
tail_length=0,
5556
reverse=False,
5657
bounce=False,
@@ -68,6 +69,7 @@ def __init__(
6869
self._color_step = 0.95 / tail_length
6970
self._comet_colors = None
7071
self._computed_color = color
72+
self._background_color = background_color
7173
self._num_pixels = len(pixel_object)
7274
self._direction = -1 if reverse else 1
7375
self._left_side = -self._tail_length
@@ -82,7 +84,7 @@ def __init__(
8284
on_cycle_complete_supported = True
8385

8486
def _set_color(self, color):
85-
self._comet_colors = [BLACK]
87+
self._comet_colors = [self._background_color]
8688
for n in range(self._tail_length):
8789
self._comet_colors.append(
8890
calculate_intensity(color, n * self._color_step + 0.05)

0 commit comments

Comments
 (0)