Skip to content

Commit 5d27d91

Browse files
committed
adding converting function
1 parent 8fd1479 commit 5d27d91

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pygame_matplotlib/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import pygame
2+
3+
4+
def pygame_color_to_plt(color: pygame.Color):
5+
"""Convert a pygame Color to a matplot lib value."""
6+
# Interval from 0 to 1 in matplotlib
7+
return tuple(
8+
value / 255.0 for value in [color.r, color.g, color.b, color.a]
9+
)

0 commit comments

Comments
 (0)