Skip to content

Commit 5ff49a7

Browse files
committed
markdown style tweak
1 parent 6980c47 commit 5ff49a7

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1212
- Optimized startup https://github.com/Textualize/textual/pull/5869
1313
- New blank visual which makes background faster to render (note this will break snapshots tests this version) https://github.com/Textualize/textual/pull/5869
1414
- Exposed `code_indent_guides` boolean on Markdown widget
15+
- Changed code fence background to use CSS background rather than its code theme
1516

1617
## [3.4.0] - 2025-06-14
1718

docs/widget_gallery.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Display and interact with a Markdown document (adds a table of contents and brow
162162
[MarkdownViewer reference](./widgets/markdown_viewer.md){ .md-button .md-button--primary }
163163

164164

165-
```{.textual path="docs/examples/widgets/markdown_viewer.py" columns="140" lines="50" press="tab,down"}
165+
```{.textual path="docs/examples/widgets/markdown_viewer.py" columns="120" lines="50" press="tab,down"}
166166
```
167167

168168
## Markdown
@@ -172,7 +172,7 @@ Display a markdown document.
172172
[Markdown reference](./widgets/markdown.md){ .md-button .md-button--primary }
173173

174174

175-
```{.textual path="docs/examples/widgets/markdown.py" columns="140" lines="51"}
175+
```{.textual path="docs/examples/widgets/markdown.py" columns="120" lines="51"}
176176
```
177177

178178
## MaskedInput

src/textual/widgets/_markdown.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ class MarkdownBlockQuote(MarkdownBlock):
352352
DEFAULT_CSS = """
353353
MarkdownBlockQuote {
354354
background: $boost;
355-
border-left: outer $success-darken-2;
355+
border-left: outer $primary 50%;
356356
margin: 1 0;
357357
padding: 0 1;
358358
}
@@ -555,7 +555,7 @@ class MarkdownBullet(Widget):
555555
DEFAULT_CSS = """
556556
MarkdownBullet {
557557
width: auto;
558-
color: $success;
558+
color: $text;
559559
text-style: bold;
560560
&:light {
561561
color: $secondary;
@@ -613,6 +613,7 @@ class MarkdownFence(MarkdownBlock):
613613
height: auto;
614614
max-height: 20;
615615
color: rgb(210,210,210);
616+
background: $background 80%;
616617
}
617618
618619
MarkdownFence > * {
@@ -630,14 +631,19 @@ def __init__(self, markdown: Markdown, code: str, lexer: str) -> None:
630631
else self._markdown.code_light_theme
631632
)
632633

634+
def notify_style_update(self) -> None:
635+
self.call_later(self._retheme)
636+
633637
def _block(self) -> Syntax:
638+
_, background_color = self.background_colors
634639
return Syntax(
635640
self.code,
636641
lexer=self.lexer,
637642
word_wrap=False,
638643
indent_guides=self._markdown.code_indent_guides,
639644
padding=(1, 2),
640645
theme=self.theme,
646+
background_color=background_color.css,
641647
)
642648

643649
def _on_mount(self, _: Mount) -> None:

0 commit comments

Comments
 (0)