speedenator / agnoster-bash

Agnoster Theme for Bash
MIT License
217 stars 52 forks source link

Colors #1

Closed tubedogg closed 7 years ago

tubedogg commented 7 years ago

I'll start by saying I know next to nothing about this stuff. In another bash prompt setup that I was using, it had like 16 different colors for each foreground and background. Is there a way to add additional defined colors in this? This is how it defined it:

if tput setaf 1 &> /dev/null; then
        tput sgr0; # reset colors
        bold=$(tput bold);
        reset=$(tput sgr0);
        ...
        orange=$(tput setaf 166);
        ...
else
        bold='';
        reset="\e[0m";
        ...
        orange="\e[1;33m";
        ...
fi;

(Orange is the one I'm really wanting to use.)

Is this possible?

Other than that, it's working great! Thanks!

speedenator commented 7 years ago

Hi,

Glad you like it!

There's not a super great spot for that - I didn't take the time to make it that customizable. Here is a good reference on the ASCII codes: http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux

What you can do is in the fg_color() lists, add the following:

fg_color() { case "$1" in black) echo 30;; red) echo 31;; green) echo 32;; yellow) echo 33;; blue) echo 34;; magenta) echo 35;; cyan) echo 36;; white) echo 37;; orange) echo 1;33;; esac }

That should be what you want, and then use orange elsewhere as appropriate.

Let me know if that works, and feel free for a PR it that does! -e

On Sun, Mar 12, 2017 at 8:56 PM, Kevin Schumacher notifications@github.com wrote:

I'll start by saying I know next to nothing about this stuff. In another bash prompt setup that I was using, it had like 16 different colors for each foreground and background. Is there a way to add additional defined colors in this? This is how it defined it:

if tput setaf 1 &> /dev/null; then tput sgr0; # reset colors bold=$(tput bold); reset=$(tput sgr0); ... orange=$(tput setaf 166); ... else bold=''; reset="\e[0m"; ... orange="\e[1;33m"; ... fi;

(Orange is the one I'm really wanting to use.)

Is this possible?

Other than that, it's working great! Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/speedenator/agnoster-bash/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ANq9Cu7vdFZCzWE49CwBWseBJy1HlepAks5rlL5vgaJpZM4Ma0oG .

--

[image: logo-email.png]

Erik Selberg

VP Machine Learning, Amperity

(206) 915-1472 | selberg@amperity.com | https://amperity.com

2101 4th Ave. Suite 1960, Seattle, WA 98121

tubedogg commented 7 years ago

Thanks for the link. I had forgotten about that page. I figured out what I was really trying to do was use color 166 (8-bit colors), so I added it like this. In fg_color(): orange) echo 38\;5\;166;; And in bg_color(): orange) echo 48\;5\;166;;

And then it worked great. I submitted a PR just adding a comment and the orange example for people who want to customize it further.

speedenator commented 7 years ago

Added PR (sorry missed this and it was fallow for too long).

asspirin12 commented 2 years ago

This link doesn't work anymore http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux

I used a copy from the wayback machine https://web.archive.org/web/20150516204338/http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux