From b6a5824204d381df3d8d0fcf8823f23f8b7ddb55 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sun, 8 May 2022 08:31:24 +0100 Subject: [PATCH 1/9] fix for default background in svg export --- rich/console.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rich/console.py b/rich/console.py index 2f685c875..81e3f83de 100644 --- a/rich/console.py +++ b/rich/console.py @@ -2252,12 +2252,12 @@ def get_svg_style(style: Style) -> str: css_rules = [] color = ( _theme.foreground_color - if style.color is None + if (style.color is None or style.color.is_default) else style.color.get_truecolor(_theme) ) bgcolor = ( _theme.background_color - if style.bgcolor is None + if (style.bgcolor is None or style.bgcolor.is_default) else style.bgcolor.get_truecolor(_theme) ) if style.reverse: @@ -2365,7 +2365,8 @@ def stringify(value: object) -> str: else style.color.get_truecolor(_theme).hex ) else: - has_background = style.bgcolor is not None + bgcolor = style.bgcolor + has_background = bgcolor is not None and not bgcolor.is_default background = ( _theme.background_color.hex if style.bgcolor is None From 2c21b51d2e713016b271b66fc6f3ffb93eec3daf Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sun, 8 May 2022 08:33:56 +0100 Subject: [PATCH 2/9] changlog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 692249f2e..111f4d8d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [12.4.1] - Unreleased + +### Fixed + +- Fix for https://github.com/Textualize/rich/issues/2260 + ## [12.4.0] - 2022-05-07 ### Changed From 7cbbd6ba6a1956429cea8687abf32a38fa466cb7 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sun, 8 May 2022 08:34:41 +0100 Subject: [PATCH 3/9] version links --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 111f4d8d4..f32d98304 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1736,7 +1736,8 @@ Major version bump for a breaking change to `Text.stylize signature`, which corr - First official release, API still to be stabilized -[unreleased]: https://github.com/willmcgugan/rich/compare/v12.4.0...HEAD +[unreleased]: https://github.com/willmcgugan/rich/compare/v12.4.1...HEAD +[12.4.1]: https://github.com/willmcgugan/rich/compare/v12.4.0...v12.4.1 [12.4.0]: https://github.com/willmcgugan/rich/compare/v12.3.0...v12.4.0 [12.3.0]: https://github.com/willmcgugan/rich/compare/v12.2.0...v12.3.0 [12.2.0]: https://github.com/willmcgugan/rich/compare/v12.1.0...v12.2.0 From 8f066de5248ff860aa5eb7158abc1a3bc9c6c967 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sun, 8 May 2022 12:15:11 +0100 Subject: [PATCH 4/9] tweaks to SVG output --- rich/_export_format.py | 3 ++- rich/console.py | 12 ++++++++++++ rich/terminal_theme.py | 26 ++++++++++++++++++++++++-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/rich/_export_format.py b/rich/_export_format.py index cc59e965f..b7ec63ff9 100644 --- a/rich/_export_format.py +++ b/rich/_export_format.py @@ -21,6 +21,7 @@ CONSOLE_SVG_FORMAT = """\ +