Skip to content

Commit

Permalink
Merge pull request #90 from FoamyGuy/colorconvert_in_docstring
Browse files Browse the repository at this point in the history
Colorconvert in docstring
  • Loading branch information
dhalbert authored Nov 7, 2024
2 parents c1051f9 + 04bdc7d commit 295e799
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions adafruit_imageload/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Union,
)

from displayio import Bitmap, Palette
from displayio import Bitmap, ColorConverter, Palette

from .displayio_types import BitmapConstructor, PaletteConstructor
except ImportError:
Expand All @@ -39,7 +39,7 @@ def load(
*,
bitmap: Optional[BitmapConstructor] = None,
palette: Optional[PaletteConstructor] = None,
) -> Tuple[Bitmap, Optional[Palette]]:
) -> Tuple[Bitmap, Optional[Union[Palette, ColorConverter]]]:
"""Load pixel values (indices or colors) into a bitmap and colors into a palette.
bitmap is the desired type. It must take width, height and color_depth in the constructor. It
Expand Down
9 changes: 5 additions & 4 deletions adafruit_imageload/bmp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

try:
from io import BufferedReader
from typing import List, Optional, Set, Tuple
from typing import List, Optional, Set, Tuple, Union

from displayio import Bitmap, Palette
from displayio import Bitmap, ColorConverter, Palette

from ..displayio_types import BitmapConstructor, PaletteConstructor
except ImportError:
Expand All @@ -32,10 +32,11 @@ def load(
*,
bitmap: Optional[BitmapConstructor] = None,
palette: Optional[PaletteConstructor] = None,
) -> Tuple[Optional[Bitmap], Optional[Palette]]:
) -> Tuple[Optional[Bitmap], Optional[Union[Palette, ColorConverter]]]:
"""Loads a bmp image from the open ``file``.
Returns tuple of bitmap object and palette object.
Returns tuple of `displayio.Bitmap` object and
`displayio.Palette` object, or `displayio.ColorConverter` object.
:param io.BufferedReader file: Open file handle or compatible (like `io.BytesIO`)
with the data of a BMP file.
Expand Down

0 comments on commit 295e799

Please sign in to comment.