Skip to content

buffer.insert_text with color? #1511

Open
@academo

Description

@academo

I'm trying to create a simple log, but I want the log to have colors.

    buffer = Buffer()  # Editable buffer.
    main_window = Window(content=BufferControl(buffer=buffer))
    status_window = Window(height=1, content=FormattedTextControl(text="Status Bar"))
    root_container = HSplit([main_window, status_window])
    layout = Layout(root_container)
    app = Application(key_bindings=kb, layout=layout, full_screen=True)
    app.run()

at some point in a thread I run buffer.insert_text which works just as expected, but I can't put any color to it. If I try ansi It gets escaped in a weird way, ANSI, HTML, format_text and other similar tools won't work.

How can I print color in a buffer?

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