Merge pull request #1 from Tuurlijk/master

Implement support for 256 colors
This commit is contained in:
James Dinsdale 2017-05-26 21:24:04 +01:00 committed by GitHub
commit 57c9cd51c0
2 changed files with 6 additions and 0 deletions

View file

@ -21,6 +21,10 @@ color red "This string will be red"
color g "This string will be green" color g "This string will be green"
color y "This string will be yellow" color y "This string will be yellow"
# Using numbers for colors
color 28 "This string will be dark green"
color 250 "This string will be light grey"
# Using styles # Using styles
color black underline "This string will be black and underlined" color black underline "This string will be black and underlined"
color r b "This string will be red and bold" color r b "This string will be red and bold"
@ -36,6 +40,7 @@ color r b "This string will be red and bold"
* magenta (m) * magenta (m)
* cyan (c) * cyan (c)
* white (w) * white (w)
* [0-256] - https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
### Available Styles ### Available Styles

View file

@ -22,6 +22,7 @@ function color() {
magenta|m) echo "\033[${b};35m${@}\033[0;m" ;; magenta|m) echo "\033[${b};35m${@}\033[0;m" ;;
cyan|c) echo "\033[${b};36m${@}\033[0;m" ;; cyan|c) echo "\033[${b};36m${@}\033[0;m" ;;
white|w) echo "\033[${b};37m${@}\033[0;m" ;; white|w) echo "\033[${b};37m${@}\033[0;m" ;;
*) echo "\033[${b};38;5;$(( ${color} ))m${@}\033[0;m" ;;
esac esac
} }