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