jroimartin / gocui

Minimalist Go package aimed at creating Console User Interfaces.
BSD 3-Clause "New" or "Revised" License
9.91k stars 608 forks source link

Colored title #133

Open maja42 opened 6 years ago

maja42 commented 6 years ago

It would be really nice to allow view titles to be colorized independently of the frame.

if v, err := g.SetView("command", 0, 0, 50, 50); err != nil && err != gocui.ErrUnknownView 
{
    return err
} else if err == gocui.ErrUnknownView {
    v.Title = "\x1b[0;31mRed text \x1b[0;32m Green text \x1b[0m Normal text"
}

Currently, escape sequences like those above are printed as standard ASCII-characters to the output:

Output

euclaise commented 6 years ago

Here's one way of implementing colorable titles into gocui: https://github.com/jroimartin/gocui/pull/145 It's not ANSI sequences, but it is color