mirror of
https://github.com/molovo/color.git
synced 2026-09-10 07:16:26 -04:00
Merge pull request #1 from Tuurlijk/master
Implement support for 256 colors
This commit is contained in:
commit
57c9cd51c0
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue