Skip to content

Commit 718e54e

Browse files
authored
Merge pull request #4142 from Textualize/tint-fix
Fix issue with tint applied to ANSI colors
2 parents ca3d9f6 + 40863d0 commit 718e54e

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88

9+
## [0.51.1] - 2023-02-09
10+
11+
### Fixed
12+
13+
- Fixed tint applied to ANSI colors
14+
915
## [0.50.0] - 2023-02-08
1016

1117
### Fixed
@@ -1677,6 +1683,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040
16771683
- New handler system for messages that doesn't require inheritance
16781684
- Improved traceback handling
16791685

1686+
[0.50.1]: https://github.com/Textualize/textual/compare/v0.50.0...v0.50.1
16801687
[0.50.0]: https://github.com/Textualize/textual/compare/v0.49.0...v0.50.0
16811688
[0.49.1]: https://github.com/Textualize/textual/compare/v0.49.0...v0.49.1
16821689
[0.49.0]: https://github.com/Textualize/textual/compare/v0.48.2...v0.49.0

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 = "textual"
3-
version = "0.50.0"
3+
version = "0.50.1"
44
homepage = "https://github.com/Textualize/textual"
55
repository = "https://github.com/Textualize/textual"
66
documentation = "https://textual.textualize.io/"

src/textual/renderables/tint.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
from typing import Iterable
44

5+
from rich import terminal_theme
56
from rich.console import Console, ConsoleOptions, RenderableType, RenderResult
67
from rich.segment import Segment
78
from rich.style import Style
89

910
from ..color import Color
11+
from ..filter import ANSIToTruecolor
1012

1113

1214
class Tint:
@@ -43,13 +45,15 @@ def process_segments(
4345
style_from_color = Style.from_color
4446
_Segment = Segment
4547

48+
truecolor_style = ANSIToTruecolor(terminal_theme.DIMMED_MONOKAI).truecolor_style
49+
4650
NULL_STYLE = Style()
4751
for segment in segments:
4852
text, style, control = segment
4953
if control:
5054
yield segment
5155
else:
52-
style = style if style is not None else NULL_STYLE
56+
style = truecolor_style(style) if style is not None else NULL_STYLE
5357
yield _Segment(
5458
text,
5559
(

0 commit comments

Comments
 (0)