use internals
This commit is contained in:
@@ -43,7 +43,9 @@ _rain_build_colors()
|
|||||||
RAIN_ENGINE_COLORS=()
|
RAIN_ENGINE_COLORS=()
|
||||||
|
|
||||||
local use_truecolor=0
|
local use_truecolor=0
|
||||||
_rainbow_supports_truecolor && use_truecolor=1
|
# term_set() already sets TERM=*-direct when truecolor is available;
|
||||||
|
# honour COLORTERM as a belt-and-suspenders fallback.
|
||||||
|
[[ "$TERM" == *direct* || "${COLORTERM:-}" == "truecolor" || "${COLORTERM:-}" == "24bit" ]] && use_truecolor=1
|
||||||
|
|
||||||
if (( use_truecolor )); then
|
if (( use_truecolor )); then
|
||||||
# 24-bit gradient from a near-black shade to a vivid hue.
|
# 24-bit gradient from a near-black shade to a vivid hue.
|
||||||
@@ -148,23 +150,6 @@ _rain_normalize_density()
|
|||||||
printf "%s" "$raw_density"
|
printf "%s" "$raw_density"
|
||||||
}
|
}
|
||||||
|
|
||||||
_rainbow_supports_truecolor()
|
|
||||||
{
|
|
||||||
case "${COLORTERM:-}" in
|
|
||||||
*truecolor*|*24bit*)
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "${TERM:-}" in
|
|
||||||
*direct*|*truecolor*)
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
_rainbow_build_palette()
|
_rainbow_build_palette()
|
||||||
{
|
{
|
||||||
local palette_width="$1"
|
local palette_width="$1"
|
||||||
@@ -661,7 +646,7 @@ rainbow()
|
|||||||
((term_width < 1)) && term_width=1
|
((term_width < 1)) && term_width=1
|
||||||
((term_height < 1)) && term_height=1
|
((term_height < 1)) && term_height=1
|
||||||
|
|
||||||
if _rainbow_supports_truecolor; then
|
if [[ "$TERM" == *direct* || "${COLORTERM:-}" == "truecolor" || "${COLORTERM:-}" == "24bit" ]]; then
|
||||||
use_truecolor=1
|
use_truecolor=1
|
||||||
else
|
else
|
||||||
use_truecolor=0
|
use_truecolor=0
|
||||||
|
|||||||
Reference in New Issue
Block a user