Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code blocks with no specified language/syntax are unreadable in light mode #2400

Closed
davep opened this issue Apr 27, 2023 · 1 comment · Fixed by #2402
Closed

Code blocks with no specified language/syntax are unreadable in light mode #2400

davep opened this issue Apr 27, 2023 · 1 comment · Fixed by #2402
Labels
bug Something isn't working Task

Comments

@davep
Copy link
Contributor

davep commented Apr 27, 2023

The following code:

from textual.app        import App, ComposeResult
from textual.containers import VerticalScroll
from textual.widgets    import Header, Footer, Markdown

MARKDOWN = """\
# Hello world!

Here is some Python code in a code block:

```python
def hello() -> str:
    return "Hello!"
```

Here is some plain text in a code block:

```
Hello!
```

"""
class MDCodeBlocksApp( App[ None ] ):

    def compose( self ) -> ComposeResult:
        yield Header()
        with VerticalScroll():
            yield Markdown( MARKDOWN )
        yield Footer()

    def on_mount( self ) -> None:
        self.dark = False

if __name__ == "__main__":
    MDCodeBlocksApp().run()

results in this:

Screenshot 2023-04-27 at 11 25 53

Note how code blocks are always a dark background but in light mode the text for the block with no syntax inverts the text colour. Here's the same code but with the one true mode:

Screenshot 2023-04-27 at 11 27 03

@davep davep added bug Something isn't working Task labels Apr 27, 2023
davep added a commit to davep/textual-sandbox that referenced this issue Apr 27, 2023
davep added a commit to davep/textual that referenced this issue Apr 27, 2023
Bit of a workaround at the moment; ideally longer-term we'll go with
something less hard-coded.

See Textualize#2400
willmcgugan pushed a commit that referenced this issue Apr 27, 2023
Bit of a workaround at the moment; ideally longer-term we'll go with
something less hard-coded.

See #2400
@github-actions
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant