Skip to content

Commit 481a2fb

Browse files
authored
Merge pull request #5757 from Textualize/fix-tint
Fix tint
2 parents 8415e07 + af8dba4 commit 481a2fb

File tree

5 files changed

+177
-3
lines changed

5 files changed

+177
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8-
## Unreleased
8+
9+
## [3.1.1] - 2024-04-22
910

1011
### Fixed
1112

13+
- Fixed issue with tint filter https://github.com/Textualize/textual/pull/5757
1214
- Fixed a crash when setting keymap before app mount https://github.com/Textualize/textual/issues/5742
1315

1416
## [3.1.0] - 2025-04-12
@@ -2852,6 +2854,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040
28522854
- New handler system for messages that doesn't require inheritance
28532855
- Improved traceback handling
28542856

2857+
[3.1.1]: https://github.com/Textualize/textual/compare/v3.1.0...v3.1.1
28552858
[3.1.0]: https://github.com/Textualize/textual/compare/v3.0.1...v3.1.0
28562859
[3.0.1]: https://github.com/Textualize/textual/compare/v3.0.0...v3.0.1
28572860
[3.0.0]: https://github.com/Textualize/textual/compare/v2.1.2...v3.0.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 = "3.1.0"
3+
version = "3.1.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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def process_segments(
5252
_Segment = Segment
5353

5454
truecolor_style = ANSIToTruecolor(ansi_theme).truecolor_style
55+
background_rich_color = background.rich_color
5556

5657
NULL_STYLE = Style()
5758
for segment in segments:
@@ -60,7 +61,7 @@ def process_segments(
6061
yield segment
6162
else:
6263
style = (
63-
truecolor_style(style, background)
64+
truecolor_style(style, background_rich_color)
6465
if style is not None
6566
else NULL_STYLE
6667
)
Lines changed: 151 additions & 0 deletions
Loading

tests/snapshot_tests/test_snapshots.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4002,3 +4002,22 @@ def compose(self) -> ComposeResult:
40024002
yield NonFocusable("NON FOCUSABLE")
40034003

40044004
assert snap_compare(FocusApp())
4005+
4006+
4007+
def test_tint(snap_compare):
4008+
"""Test that tint applied to dim text doesn't break.
4009+
4010+
You should see the text Hello, World with a 50% green tint."""
4011+
4012+
class TintApp(App):
4013+
CSS = """
4014+
Label {
4015+
tint: green 50%;
4016+
text-style: dim;
4017+
}
4018+
"""
4019+
4020+
def compose(self) -> ComposeResult:
4021+
yield Label("Hello, World")
4022+
4023+
assert snap_compare(TintApp())

0 commit comments

Comments
 (0)