Skip to content

buffer.insert_text with color? #1511

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

Open
academo opened this issue Oct 17, 2021 · 1 comment
Open

buffer.insert_text with color? #1511

academo opened this issue Oct 17, 2021 · 1 comment

Comments

@academo
Copy link

academo commented Oct 17, 2021

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?

@trevorbayless
Copy link

Related to #711

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants