4

I am using the rich module to enable markdown support in the terminal. However, I am using a light-themed terminal and the default colors of rich markdown highlighting look borderline unreadable. So how would I go about changing the color scheme used by rich.Markdown?

The code highlighting is almost unreadable

The text above is the following:

To use rich, we first import

from rich.console import Console
from rich.markdown import Markdown

and then we can write

console.print(Markdown(msg))

Note that using a dark-themed terminal works great with the default color scheme.

I looked through the docs of rich, in particular Styles, Highlights and Markdown. However none of them seem to be able to answer my question of how I could support light theme (i.e. change to a custom color scheme for markdown).

You can create custom themes as shown in Style Themes, however those seem to only apply if you print to the console manually (and not if you use markdown).

Any help would be greatly appreciated.

Racid
  • 141
  • 8

0 Answers0