mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-22 14:21:33 +03:00
Clean up attempt at more optimal color inverting
I don't want to bother importing Rich's Color class in addition to Textual's Color class. This also doesn't work, which might be the fastest if it worked: style.color.triplet.red = 255 - style.color.triplet.red style.color.triplet.green = 255 - style.color.triplet.green style.color.triplet.blue = 255 - style.color.triplet.blue style.bgcolor.triplet.red = 255 - style.bgcolor.triplet.red style.bgcolor.triplet.green = 255 - style.bgcolor.triplet.green style.bgcolor.triplet.blue = 255 - style.bgcolor.triplet.blue
This commit is contained in:
parent
bf16e60509
commit
c659418240
2
paint.py
2
paint.py
@ -741,8 +741,6 @@ class Canvas(Widget):
|
|||||||
style = Style.parse(fg+" on "+bg)
|
style = Style.parse(fg+" on "+bg)
|
||||||
if self.magnifier_preview_region and self.magnifier_preview_region.contains(x, y) and not inner_magnifier_preview_region.contains(x, y):
|
if self.magnifier_preview_region and self.magnifier_preview_region.contains(x, y) and not inner_magnifier_preview_region.contains(x, y):
|
||||||
# invert the colors
|
# invert the colors
|
||||||
# style.bgcolor = rich.Color.from_rgb(255 - style.bgcolor.triplet.red, 255 - style.bgcolor.triplet.green, 255 - style.bgcolor.triplet.blue)
|
|
||||||
# style.color = rich.Color.from_rgb(255 - style.color.triplet.red, 255 - style.color.triplet.green, 255 - style.color.triplet.blue)
|
|
||||||
style = Style.parse(f"rgb({255 - style.color.triplet.red},{255 - style.color.triplet.green},{255 - style.color.triplet.blue}) on rgb({255 - style.bgcolor.triplet.red},{255 - style.bgcolor.triplet.green},{255 - style.bgcolor.triplet.blue})")
|
style = Style.parse(f"rgb({255 - style.color.triplet.red},{255 - style.color.triplet.green},{255 - style.color.triplet.blue}) on rgb({255 - style.bgcolor.triplet.red},{255 - style.bgcolor.triplet.green},{255 - style.bgcolor.triplet.blue})")
|
||||||
segments.append(Segment(ch, style))
|
segments.append(Segment(ch, style))
|
||||||
return Strip(segments, self.size.width)
|
return Strip(segments, self.size.width)
|
||||||
|
Loading…
Reference in New Issue
Block a user