Easy way to override byobu plugin colors in a user's local configuration file?

StackOverflow https://stackoverflow.com/questions/19039999

  •  29-06-2022
  •  | 
  •  

Question

I'd like to change the colors of all the built-in byobu plugins/indicators to match my solarized palette for tmux/vim/emacs/terminal.

Is there an easy way to override them in the user's rc file or would I have to change them in /usr/lib/byobu/* ?

Was it helpful?

Solution

This is possible, in fact.

You'll want to grab the definition of the color_map() function, which is defined in /usr/lib/byobu/include/shutil.

Copy that entire function and paste it into your local user's ~/.byobu/color.tmux configuration file. That function currently looks something like this:

color_map() {
        case "$1" in
                "k") _RET="black" ;;
                "r") _RET="red" ;;
                "g") _RET="green" ;;
                "y") _RET="yellow" ;;
                "b") _RET="blue" ;;
                "m") _RET="magenta" ;;
                "c") _RET="cyan" ;;
                "w") _RET="white" ;;
                "d") _RET="black" ;;
                "K") _RET="brightblack" ;;
                "R") _RET="brightred" ;;
                "G") _RET="brightgreen" ;;
                "Y") _RET="brightyellow" ;;
                "B") _RET="brightblue" ;;
                "M") _RET="brightmagenta" ;;
                "C") _RET="brightcyan" ;;
                "W") _RET="brightwhite" ;;
                *) _RET= ;;
        esac
}

Now, you can change those colors, as you like. For instance, if you change the "Y" definition from "brightyellow" to "magenta", you should see your system load indicator go from yellow to purple.

If you're using solarized, you'll probably want to use Tmux's 256-color support. In which case, you'll probably want to specify a 256-color choice rather than a 16-color choice, such as "color52" You can use this xterm color chart as a guide:

xterm color chart

And if you do create a solarized theme, please do share it, as I would be happy to include it in [Byobu][2] as an option!

Full disclosure: I am the author and maintainer of Byobu.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top