Added greyscale and rgb options for ext:
colours.
This commit is contained in:
@ -162,6 +162,26 @@ function ansi_color()
|
||||
fi
|
||||
}
|
||||
|
||||
function ext_grey()
|
||||
{
|
||||
use_8_bit=1
|
||||
grey_val=${1}
|
||||
if (( ${grey_val} < 0 || ${grey_val} > 23 ))
|
||||
then
|
||||
echo "ERROR!" 1>&2 ; exit -1
|
||||
fi
|
||||
ext_8_bit=$(( 232 + ${grey_val} ))
|
||||
}
|
||||
|
||||
function ext_rgb()
|
||||
{
|
||||
use_8_bit=1
|
||||
red_ext_val=$((6#${1:0:1}))
|
||||
green_ext_val=$((6#${1:1:1}))
|
||||
blue_ext_val=$((6#${1:2:1}))
|
||||
ext_8_bit=$(( 16 + 36 * ${red_ext_val} + 6 * ${green_ext_val} + ${blue_ext_val} ))
|
||||
}
|
||||
|
||||
function ext_color()
|
||||
{
|
||||
use_8_bit=1
|
||||
@ -371,18 +391,24 @@ function build_sgr_code()
|
||||
reveal) next=28 ;;
|
||||
|
||||
ansi:*) make_color 0 ansi_color ${1:5} ;;
|
||||
ext:grey*) make_color 0 ext_grey ${1:8} ;;
|
||||
ext:rgb*) make_color 0 ext_rgb ${1:7} ;;
|
||||
ext:*) make_color 0 ext_color ${1:4} ;;
|
||||
# 12-bit color also supported
|
||||
[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) make_color 0 rgb_color $1 ;;
|
||||
[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) make_color 0 rgb_color $1 ;;
|
||||
|
||||
fg:ansi:*) make_color 0 ansi_color ${1:8} ;;
|
||||
fg:ext:grey*) make_color 0 ext_grey ${1:11} ;;
|
||||
fg:ext:rgb*) make_color 0 ext_rgb ${1:10} ;;
|
||||
fg:ext:*) make_color 0 ext_color ${1:7} ;;
|
||||
# 12-bit color also supported
|
||||
fg:[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) make_color 0 rgb_color ${1:3} ;;
|
||||
fg:[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) make_color 0 rgb_color ${1:3} ;;
|
||||
|
||||
bg:ansi:*) make_color 1 ansi_color ${1:8} ;;
|
||||
bg:ext:grey*) make_color 1 ext_grey ${1:11} ;;
|
||||
bg:ext:rgb*) make_color 1 ext_rgb ${1:10} ;;
|
||||
bg:ext:*) make_color 1 ext_color ${1:7} ;;
|
||||
# 12-bit color also supported
|
||||
bg:[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) make_color 1 rgb_color ${1:3} ;;
|
||||
|
Reference in New Issue
Block a user