Skip to content

Markup colors are getting reset with a newline character #5820

@djp3

Description

@djp3

Markup colors are being reset after a newline character

An example of output showcasing the bug.
The second line should be white
Image

Example program to demonstrate bug:

from textual.widgets import Label


class LabelApp(App):
    def compose(self) -> ComposeResult:
        yield Label("[#ff0000]Hello, [#ffffff]world!\nMy work here is done.")


if __name__ == "__main__":
    app = LabelApp()
    app.run()

What I expect

The second and subsequent lines should be white.

Textual Diagnostics

Versions

Name Value
Textual 3.2.0
Rich 14.0.0

Python

Name Value
Version 3.13.3
Implementation CPython
Compiler Clang 16.0.0 (clang-1600.0.26.6)
Executable /Users/djp3/Downloads/temp/sample/bin/python3.13

Operating System

Name Value
System Darwin
Release 24.5.0
Version Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:27 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6041

Terminal

Name Value
Terminal Application iTerm.app (3.5.13)
TERM xterm-256color
COLORTERM truecolor
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=212, height=79
legacy_windows False
min_width 1
max_width 212
is_terminal True
encoding utf-8
max_height 79
justify None
overflow None
no_wrap False
highlight None
markup None
height None

Thanks for working on this framework. It rocks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions