Positional argument Segments

This commit is contained in:
Darren Burns
2022-02-10 10:41:05 +00:00
parent 42b1f7ef4a
commit 3e890037c8
2 changed files with 6 additions and 6 deletions

View File

@@ -34,11 +34,11 @@ class Opacity:
bg = style.bgcolor
if fg and fg.triplet and bg and bg.triplet:
yield Segment(
text=segment.text,
style=_get_blended_style_cached(
segment.text,
_get_blended_style_cached(
fg_color=fg, bg_color=bg, opacity=opacity
),
control=segment.control,
segment.control,
)
else:
yield segment

View File

@@ -64,10 +64,10 @@ class Sparkline:
width = self.width or options.max_width
len_data = len(self.data)
if len_data == 0:
yield Segment("" * width, style=self.min_color)
yield Segment("" * width, self.min_color)
return
if len_data == 1:
yield Segment("" * width, style=self.max_color)
yield Segment("" * width, self.max_color)
return
minimum, maximum = min(self.data), max(self.data)
@@ -88,7 +88,7 @@ class Sparkline:
bar_color = blend_colors(min_color, max_color, height_ratio)
bars_rendered += 1
bucket_index += step
yield Segment(text=self.BARS[bar_index], style=Style.from_color(bar_color))
yield Segment(self.BARS[bar_index], Style.from_color(bar_color))
if __name__ == "__main__":