Skip to content

Commit

Permalink
feat: added longitudinal color
Browse files Browse the repository at this point in the history
closed #150
  • Loading branch information
Disane87 committed Dec 16, 2024
1 parent bbd7025 commit d2f2809
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions custom_components/spoolman/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,12 @@ def _generate_entity_picture(spool_data, image_dir):
(i * step, 0),
((i + 1) * step - 1, image_size[1])
], fill=f"#{color}")
else:
# Alternate style: radial (circular gradient)
elif multi_color_direction == "longitudinal":
step = image_size[1] // len(colors)
for i, color in enumerate(colors):
radius = image_size[0] // (2 * len(colors)) * (i + 1)
draw.ellipse([
(image_size[0] // 2 - radius, image_size[1] // 2 - radius),
(image_size[0] // 2 + radius, image_size[1] // 2 + radius)
draw.rectangle([
(0, i * step),
(image_size[0], (i + 1) * step - 1)
], fill=f"#{color}")
else:
# Single color fallback
Expand Down

0 comments on commit d2f2809

Please # to comment.