Skip to content

Commit a47549e

Browse files
committed
Hotfix 2.4.1
- Fixed a bug where `Style` was added to `segments`.
1 parent 8810ea9 commit a47549e

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "ripix"
3-
version = "2.4.0"
3+
version = "2.4.1"
44
description = "A Rich-compatible library for writing pixel images and ASCII art to the terminal."
55
authors = ["Darren Burns <darrenb900@gmail.com>", "Romanin <semina054@gmail.com>"]
66
repository = "https://github.com/romanin-rf/ripix"

ripix/pixel.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ def _segments_from_image(
5959
this_row = []
6060
for x in range(height):
6161
r, g, b, a = image.getpixel((x, y))
62-
if a > 0:
63-
this_row.append(Style.parse(f"on rgb({r},{g},{b})"))
64-
else:
65-
this_row.append(null_style)
62+
style = Style.parse(f"on rgb({r},{g},{b})") if a > 0 else null_style
63+
this_row.append(Segment(style))
6664
this_row.append(Segment("\n", null_style))
6765
segments += this_row
6866
return segments
@@ -154,10 +152,8 @@ async def _segments_from_image(
154152
this_row = []
155153
for x in range(height):
156154
r, g, b, a = image.getpixel((x, y))
157-
if a > 0:
158-
this_row.append(Style.parse(f"on rgb({r},{g},{b})"))
159-
else:
160-
this_row.append(null_style)
155+
style = Style.parse(f"on rgb({r},{g},{b})") if a > 0 else null_style
156+
this_row.append(Segment(style))
161157
this_row.append(Segment("\n", null_style))
162158
segments += this_row
163159
return segments

0 commit comments

Comments
 (0)