mirror of
https://github.com/hassio-addons/bashio.git
synced 2025-05-06 20:11:24 +00:00
🔥 Limits ANSI colors to the colors Hassio supports
This commit is contained in:
parent
1a5ae939c6
commit
97bcf64e6f
3 changed files with 7 additions and 146 deletions
125
lib/color.sh
125
lib/color.sh
|
@ -70,69 +70,6 @@ function bashio::color.cyan() {
|
|||
echo -n -e "${__BASHIO_COLORS_CYAN}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color to light grey.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.light_grey() {
|
||||
echo -n -e "${__BASHIO_COLORS_LIGHT_GRAY}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color to dark grey.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.dark_grey() {
|
||||
echo -n -e "${__BASHIO_COLORS_DARK_GRAY}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color to light red.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.light_red() {
|
||||
echo -n -e "${__BASHIO_COLORS_LIGHT_RED}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color to light green.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.light_green() {
|
||||
echo -n -e "${__BASHIO_COLORS_LIGHT_GREEN}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color to light yellow.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.light_yellow() {
|
||||
echo -n -e "${__BASHIO_COLORS_LIGHT_YELLOW}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color to light blue.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.light_blue() {
|
||||
echo -n -e "${__BASHIO_COLORS_LIGHT_BLUE}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color to light magenta.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.light_magenta() {
|
||||
echo -n -e "${__BASHIO_COLORS_LIGHT_MAGENTA}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color to light cyan.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.light_cyan() {
|
||||
echo -n -e "${__BASHIO_COLORS_LIGHT_CYAN}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color to white.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.white() {
|
||||
echo -n -e "${__BASHIO_COLORS_WHITE}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color background to default.
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -190,64 +127,8 @@ function bashio::color.bg.cyan() {
|
|||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color background to light gray.
|
||||
# Set font output color background to white.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.bg.light_gray() {
|
||||
echo -n -e "${__BASHIO_COLORS_BG_LIGHT_GRAY}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color background to dark gray.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.bg.dark_gray() {
|
||||
echo -n -e "${__BASHIO_COLORS_BG_DARK_GRAY}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color background to light red.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.bg.light_red() {
|
||||
echo -n -e "${__BASHIO_COLORS_BG_LIGHT_RED}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color background to light green.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.bg.light_green() {
|
||||
echo -n -e "${__BASHIO_COLORS_BG_LIGHT_GREEN}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color background to light yellow.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.bg.light_yellow() {
|
||||
echo -n -e "${__BASHIO_COLORS_BG_LIGHT_YELLOW}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color background to light blue.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.bg.light_blue() {
|
||||
echo -n -e "${__BASHIO_COLORS_BG_LIGHT_BLUE}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color background to light magenta.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.bg.light_magenta() {
|
||||
echo -n -e "${__BASHIO_COLORS_BG_LIGHT_MAGENTA}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color background to light cyan.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.bg.light_cyan() {
|
||||
echo -n -e "${__BASHIO_COLORS_BG_LIGHT_CYAN}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Set font output color background to light white.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::color.bg.light_white() {
|
||||
echo -n -e "${__BASHIO_COLORS_BG_LIGHT_WHITE}"
|
||||
function bashio::color.bg.white() {
|
||||
echo -n -e "${__BASHIO_COLORS_BG_WHITE}"
|
||||
}
|
||||
|
|
20
lib/const.sh
20
lib/const.sh
|
@ -47,7 +47,7 @@ readonly -A __BASHIO_LOG_LEVELS=(
|
|||
# Colors
|
||||
readonly __BASHIO_COLORS_ESCAPE="\033[";
|
||||
readonly __BASHIO_COLORS_RESET="${__BASHIO_COLORS_ESCAPE}0m"
|
||||
readonly __BASHIO_COLORS_DEFAULT="${__BASHIO_COLORS_ESCAPE}49m"
|
||||
readonly __BASHIO_COLORS_DEFAULT="${__BASHIO_COLORS_ESCAPE}39m"
|
||||
readonly __BASHIO_COLORS_BLACK="${__BASHIO_COLORS_ESCAPE}30m"
|
||||
readonly __BASHIO_COLORS_RED="${__BASHIO_COLORS_ESCAPE}31m"
|
||||
readonly __BASHIO_COLORS_GREEN="${__BASHIO_COLORS_ESCAPE}32m"
|
||||
|
@ -56,14 +56,6 @@ readonly __BASHIO_COLORS_BLUE="${__BASHIO_COLORS_ESCAPE}34m"
|
|||
readonly __BASHIO_COLORS_MAGENTA="${__BASHIO_COLORS_ESCAPE}35m"
|
||||
readonly __BASHIO_COLORS_CYAN="${__BASHIO_COLORS_ESCAPE}36m"
|
||||
readonly __BASHIO_COLORS_LIGHT_GRAY="${__BASHIO_COLORS_ESCAPE}37m"
|
||||
readonly __BASHIO_COLORS_DARK_GRAY="${__BASHIO_COLORS_ESCAPE}90m"
|
||||
readonly __BASHIO_COLORS_LIGHT_RED="${__BASHIO_COLORS_ESCAPE}91m"
|
||||
readonly __BASHIO_COLORS_LIGHT_GREEN="${__BASHIO_COLORS_ESCAPE}92m"
|
||||
readonly __BASHIO_COLORS_LIGHT_YELLOW="${__BASHIO_COLORS_ESCAPE}93m"
|
||||
readonly __BASHIO_COLORS_LIGHT_BLUE="${__BASHIO_COLORS_ESCAPE}94m"
|
||||
readonly __BASHIO_COLORS_LIGHT_MAGENTA="${__BASHIO_COLORS_ESCAPE}95m"
|
||||
readonly __BASHIO_COLORS_LIGHT_CYAN="${__BASHIO_COLORS_ESCAPE}96m"
|
||||
readonly __BASHIO_COLORS_WHITE="${__BASHIO_COLORS_ESCAPE}97m"
|
||||
readonly __BASHIO_COLORS_BG_DEFAULT="${__BASHIO_COLORS_ESCAPE}49m"
|
||||
readonly __BASHIO_COLORS_BG_BLACK="${__BASHIO_COLORS_ESCAPE}40m"
|
||||
readonly __BASHIO_COLORS_BG_RED="${__BASHIO_COLORS_ESCAPE}41m"
|
||||
|
@ -72,12 +64,4 @@ readonly __BASHIO_COLORS_BG_YELLOW="${__BASHIO_COLORS_ESCAPE}43m"
|
|||
readonly __BASHIO_COLORS_BG_BLUE="${__BASHIO_COLORS_ESCAPE}44m"
|
||||
readonly __BASHIO_COLORS_BG_MAGENTA="${__BASHIO_COLORS_ESCAPE}45m"
|
||||
readonly __BASHIO_COLORS_BG_CYAN="${__BASHIO_COLORS_ESCAPE}46m"
|
||||
readonly __BASHIO_COLORS_BG_LIGHT_GRAY="${__BASHIO_COLORS_ESCAPE}47m"
|
||||
readonly __BASHIO_COLORS_BG_DARK_GRAY="${__BASHIO_COLORS_ESCAPE}100m"
|
||||
readonly __BASHIO_COLORS_BG_LIGHT_RED="${__BASHIO_COLORS_ESCAPE}101m"
|
||||
readonly __BASHIO_COLORS_BG_LIGHT_GREEN="${__BASHIO_COLORS_ESCAPE}102m"
|
||||
readonly __BASHIO_COLORS_BG_LIGHT_YELLOW="${__BASHIO_COLORS_ESCAPE}103m"
|
||||
readonly __BASHIO_COLORS_BG_LIGHT_BLUE="${__BASHIO_COLORS_ESCAPE}104m"
|
||||
readonly __BASHIO_COLORS_BG_LIGHT_MAGENTA="${__BASHIO_COLORS_ESCAPE}105m"
|
||||
readonly __BASHIO_COLORS_BG_LIGHT_CYAN="${__BASHIO_COLORS_ESCAPE}106m"
|
||||
readonly __BASHIO_COLORS_BG_LIGHT_WHITE="${__BASHIO_COLORS_ESCAPE}107m"
|
||||
readonly __BASHIO_COLORS_BG_WHITE="${__BASHIO_COLORS_ESCAPE}47m"
|
||||
|
|
|
@ -44,9 +44,7 @@ function bashio::log.log() {
|
|||
# ------------------------------------------------------------------------------
|
||||
function bashio::log.trace() {
|
||||
local message=$*
|
||||
bashio::color.dark_grey >&2
|
||||
bashio::log.log "${__BASHIO_LOG_LEVEL_TRACE}" "${message}"
|
||||
bashio::color.reset >&2
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -57,9 +55,7 @@ function bashio::log.trace() {
|
|||
# ------------------------------------------------------------------------------
|
||||
function bashio::log.debug() {
|
||||
local message=$*
|
||||
bashio::color.dark_grey >&2
|
||||
bashio::log.log "${__BASHIO_LOG_LEVEL_DEBUG}" "${message}"
|
||||
bashio::color.reset >&2
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -70,7 +66,7 @@ function bashio::log.debug() {
|
|||
# ------------------------------------------------------------------------------
|
||||
function bashio::log.info() {
|
||||
local message=$*
|
||||
bashio::color.light_blue >&2
|
||||
bashio::color.cyan >&2
|
||||
bashio::log.log "${__BASHIO_LOG_LEVEL_INFO}" "${message}"
|
||||
bashio::color.reset >&2
|
||||
}
|
||||
|
@ -83,7 +79,7 @@ function bashio::log.info() {
|
|||
# ------------------------------------------------------------------------------
|
||||
function bashio::log.notice() {
|
||||
local message=$*
|
||||
bashio::color.cyan >&2
|
||||
bashio::color.blue >&2
|
||||
bashio::log.log "${__BASHIO_LOG_LEVEL_NOTICE}" "${message}"
|
||||
bashio::color.reset >&2
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue