From 50073423b107e54fefa94149142235f88c1fac0b Mon Sep 17 00:00:00 2001 From: Daniel Fleischer Date: Wed, 1 Jul 2026 09:46:21 +0300 Subject: [PATCH] Remove hardcoded dark background from inline markdown code Rich's default markdown.code style is 'bold cyan on black', which is unreadable on light terminals. Override the console theme to drop the black background so inline and block code adapt to the terminal. --- src/rich_cli/__main__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/rich_cli/__main__.py b/src/rich_cli/__main__.py index 98df6bb..09833b0 100644 --- a/src/rich_cli/__main__.py +++ b/src/rich_cli/__main__.py @@ -446,10 +446,19 @@ def main( if version: sys.stdout.write(f"{VERSION}\n") return + from rich.theme import Theme + console = Console( emoji=emoji, record=bool(export_html or export_svg), force_terminal=force_terminal if force_terminal else None, + theme=Theme( + { + # Override Rich's dark defaults for readable inline/block code. + "markdown.code": "bold cyan", + "markdown.code_block": "cyan", + } + ), ) def print_usage() -> None: