Skip to content

ANSI-based builtin theme #6490

Closed
Closed

Description

@mgesbert

We would need to have a builtin theme which uses only ANSI colors to natively match the colors of the terminal we are being executed in

Activity

  1. TomJGooding commented on Apr 15, 2026

    @TomJGooding
    Contributor

    Textual actually does have an ANSI theme which you can enable with ansi_color. Unfortunately since ANSI themes aren't recommended, this isn't well-documented and definitely has some bugs.

  2. willmcgugan commented on Apr 16, 2026

    @willmcgugan
    Member

    I generally recommend against ANSI themes for reasons I guess you have encountered. Some users have default themes, or even configured themes, that make some color combinations difficult to read. Your app may be illegible if a user has a light theme. And a whole host of other issues.

    The 16-color ANSI theme is an archaic holdover from days when that's all monitors could display. It is a terrible color system, and there is good reason why there is nothing like it on desktop or web apps.

    My personal opinion is that ANSI themes barely work for CLIs, and are awful for TUIs. You loose way too much.

    That said, yes Textual can do better here. And we can make it easier for projects that want to use ANSI themes.

    It's not quite as simple as adding an "ansi" option to Textual's color system. Yes, I can replace the color system with ANSI colors, but that won't make everything work in ANSI mode. ANSI doesn't support transparency. Other feature that look good with 16.7 million colors, look terrible with ANSI. Most widgets would need some level of custom CSS. There is already some custom CSS for widgets in ansi mode, but we would need some more work there.

    It also might not make everything work perfectly in Vibe. You may still need some additional customization.

    An alternative approach would be for Vibe to supply alternative styles for an ANSI mode in addition the default Textual themes. I would do this by adding a class to app, say "-vibe-ansi", then wrapping your ansi rules like this:

    App.-vibe-ansi {
        TextArea {
            background: $ansi-default
        }
    }
    

    That would allow you to toggle between ANSI and truecolor themes with app.set_class(use_ansi, "-vibe-ansi"). That may be the quickest way to get what you are looking for.

    There is plenty nuance here. Suggest we also jump on a call for this one.

  3. self-assigned this
    on Apr 16, 2026
  4. github-actions commented on Apr 30, 2026

    @github-actions

    I hope I solved your issue!

    Consider sponsoring my work to continue to maintain and develop Textual.

    • Will McGugan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions