Skip to content

Commit 1a695bb

Browse files
committed
fix: alpha_color param type
1 parent 02828b3 commit 1a695bb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pytest_image_diff/image_diff.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from io import BytesIO
2-
from typing import cast, Union
2+
from typing import cast, Union, Optional
33

44
from PIL import Image
55
from diffimg import diff
@@ -11,6 +11,7 @@
1111
OrientationType,
1212
ColorModeType,
1313
ImageType,
14+
ColorType,
1415
)
1516

1617

@@ -51,12 +52,12 @@ def resize_canvas(im: ImageType, new_size: ImageSize) -> BytesIO:
5152
def convert_color_mode(
5253
im: ImageType,
5354
color_mode: ColorModeType,
54-
alpha_color: tuple[int, int, int] = ALPHA_COLOR,
55+
alpha_color: Optional[ColorType] = ALPHA_COLOR,
5556
) -> Union[ImageType, None]:
5657
if im.mode == color_mode:
5758
return None
5859
im = im.convert("RGBA")
59-
background = Image.new("RGBA", im.size, alpha_color)
60+
background = Image.new("RGBA", im.size, alpha_color or ALPHA_COLOR)
6061

6162
alpha_image = Image.alpha_composite(im, background).convert(color_mode)
6263

0 commit comments

Comments
 (0)