refactor(ui): replace neon palette and ad-hoc echo with minimal design system

- reduce color palette to red/cyan/white/gray; alias legacy vars onto CYAN
- add show_box_top/mid/bottom, show_separator, show_menu_item, show_prompt helpers to lib/common.sh
- update apps/index.sh and tools/index.sh to use new UI helpers instead of inline echo/ANSI
- drop BLINK, REV escape codes and remove hardcoded prompt strings from callers
This commit is contained in:
2026-05-12 22:20:36 -04:00
parent ade8e76a68
commit c7dcaed0bf
4 changed files with 141 additions and 72 deletions
+11 -9
View File
@@ -34,7 +34,7 @@ run_sibling() {
local temp_file exit_code
temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh")
echo -e "${MAGENTA}[··] Fetching ${BOLD}${script_name}${NC}${MAGENTA}...${NC}"
echo -e "${CYAN}[..] Fetching ${BOLD}${script_name}${NC}${CYAN}...${NC}"
if curl -fsSL -H "Cache-Control: no-cache" -o "${temp_file}" "${LXS_RAW_BASE}/${script_path}"; then
echo -e "${GREEN}[OK] Payload acquired${NC}"
chmod +x "${temp_file}"
@@ -52,16 +52,18 @@ run_sibling() {
menu_apps() {
while true; do
clear
show_title "APPLICATIONS" "APP_REPOSITORY"
show_box_top "APPLICATIONS" "APP_REPOSITORY"
echo ""
echo -e " ${YELLOW}◢ 01${NC} ${GRAY}${NC} ${WHITE}Coolify${NC}"
echo -e " ${YELLOW}◢ 02${NC} ${GRAY}${NC} ${WHITE}Pterodactyl Panel${NC}"
echo -e " ${YELLOW}◢ 03${NC} ${GRAY}${NC} ${WHITE}Uptime Kuma${NC}"
echo -e " ${YELLOW}◢ 04${NC} ${GRAY}${NC} ${WHITE}CloudPanel${NC}"
echo -e " ${YELLOW}◢ 05${NC} ${GRAY}${NC} ${WHITE}Proxmox VE Tools${NC}"
echo -e " ${RED}◢ 00${NC} ${GRAY}${NC} ${WHITE}BACK${NC}"
show_menu_item "01" "Coolify"
show_menu_item "02" "Pterodactyl Panel"
show_menu_item "03" "Uptime Kuma"
show_menu_item "04" "CloudPanel"
show_menu_item "05" "Proxmox VE Tools"
show_menu_item "00" "BACK" "" exit
echo ""
echo -e -n "${YELLOW}${NC}${MAGENTA}_${NC} "
show_box_bottom
echo ""
show_prompt
read -r choice
case $choice in
+99 -27
View File
@@ -7,46 +7,118 @@
# Repo: https://git.hyko.cx/hykocx/lxs
# ═══════════════════════════════════════════════════════════════════════════
# Colors — Cyberpunk 2077 neon palette
# Colors — minimal palette: red, cyan, white (+ gray as a white shade)
# ═══════════════════════════════════════════════════════════════════════════
RED='\033[1;91m' # ICE alert
GREEN='\033[1;92m' # phosphor green
YELLOW='\033[1;93m' # signature electric yellow
MAGENTA='\033[1;95m' # hot pink neon
CYAN='\033[1;96m' # neon cyan
WHITE='\033[1;97m' # bold white
GRAY='\033[0;90m' # dark gray
PURPLE='\033[1;95m' # alias on MAGENTA for legacy sub-scripts
RED='\033[38;2;255;64;64m' # errors, destructive actions
CYAN='\033[38;2;0;229;255m' # accents, titles, OK, info
WHITE='\033[38;2;240;240;240m' # primary text
GRAY='\033[38;2;140;140;140m' # secondary text, comments, separators
NC='\033[0m'
BOLD='\033[1m'
DIM='\033[2m'
BLINK='\033[5m'
REV='\033[7m'
# Legacy aliases — older sub-scripts still reference these. Map onto CYAN
# so the palette stays at red/cyan/white without breaking them.
YELLOW="$CYAN"
GREEN="$CYAN"
MAGENTA="$CYAN"
PURPLE="$CYAN"
# ═══════════════════════════════════════════════════════════════════════════
# UI helpers
# UI helpers — title + horizontal rule, no closed box.
#
# Layout:
# show_box_top "TITLE" ["RIGHT_TAG"] → TITLE [ RIGHT ]
# ─────────────────────────────────
# show_box_mid "SECTION" → ─ SECTION ─────────────────────
# show_box_bottom → ───────────────────────────────
# show_separator → ─── (light gray divider)
# show_menu_item "01" "LABEL" "desc" → [01] LABEL // desc
# show_prompt → >
# ═══════════════════════════════════════════════════════════════════════════
_lxs_term_cols() {
local cols
cols=$(tput cols 2>/dev/null || echo 80)
[ "$cols" -gt 100 ] && cols=100
[ "$cols" -lt 60 ] && cols=60
echo "$cols"
}
show_box_top() {
local title="$1" right="${2:-}"
local cols pad_len pad
cols=$(_lxs_term_cols)
if [ -n "$right" ]; then
pad_len=$(( cols - 2 - ${#title} - ${#right} - 4 ))
[ "$pad_len" -lt 1 ] && pad_len=1
pad=$(printf ' %.0s' $(seq 1 "$pad_len"))
printf " ${CYAN}${BOLD}%s${NC}%s${GRAY}[ ${CYAN}%s${GRAY} ]${NC}\n" \
"$title" "$pad" "$right"
else
printf " ${CYAN}${BOLD}%s${NC}\n" "$title"
fi
_lxs_hr "$cols"
}
show_box_mid() {
local title="$1"
local cols fill_len fill
cols=$(_lxs_term_cols)
fill_len=$(( cols - ${#title} - 4 ))
[ "$fill_len" -lt 2 ] && fill_len=2
fill=$(printf '─%.0s' $(seq 1 "$fill_len"))
printf "${GRAY}${CYAN}${BOLD}%s${NC} ${GRAY}%s${NC}\n" "$title" "$fill"
}
show_box_bottom() {
_lxs_hr "$(_lxs_term_cols)"
}
show_separator() {
local cols
cols=$(tput cols 2>/dev/null || echo 64)
printf "${YELLOW}"
printf '▀%.0s' $(seq 1 "$cols")
printf "${NC}\n"
_lxs_hr "$(_lxs_term_cols)"
}
_lxs_hr() {
local cols=$1 fill
fill=$(printf '─%.0s' $(seq 1 "$cols"))
printf "${GRAY}%s${NC}\n" "$fill"
}
show_title() {
local title="$1"
local subtitle="${2:-SYS_MODULE}"
local subtitle="${2:-}"
echo ""
echo -e "${YELLOW}${REV} ${title} ${NC} ${MAGENTA}// ${subtitle}${NC}"
show_separator
if [ -n "$subtitle" ]; then
show_box_top "$title" "$subtitle"
else
show_box_top "$title"
fi
}
info() { echo -e "${MAGENTA}[··]${NC} $*"; }
ok() { echo -e "${GREEN}[OK]${NC} $*"; }
warn() { echo -e "${YELLOW}[!!]${NC} $*"; }
# Render a menu line. Pass "exit" as 4th arg to color the key red.
# show_menu_item "01" "APPLICATIONS" "deploy stacks"
# show_menu_item "00" "EXIT" "quit shell" exit
show_menu_item() {
local key="$1" label="$2" desc="${3:-}" kind="${4:-}"
local key_color="${CYAN}"
[ "$kind" = "exit" ] && key_color="${RED}"
if [ -n "$desc" ]; then
printf " ${key_color}[%s]${NC} ${WHITE}${BOLD}%-18s${NC} ${GRAY}// %s${NC}\n" \
"$key" "$label" "$desc"
else
printf " ${key_color}[%s]${NC} ${WHITE}${BOLD}%s${NC}\n" "$key" "$label"
fi
}
show_prompt() {
echo -e -n " ${CYAN}>${NC} "
}
info() { echo -e "${CYAN}[..]${NC} $*"; }
ok() { echo -e "${CYAN}[OK]${NC} $*"; }
warn() { echo -e "${CYAN}[!!]${NC} $*"; }
err() { echo -e "${RED}[KO]${NC} $*" >&2; }
# ═══════════════════════════════════════════════════════════════════════════
@@ -67,13 +139,13 @@ run_spinner() {
local spinstr='|/-\'
local log="${LXS_LOG_FILE:-/tmp/lxs.log}"
echo -e "${MAGENTA}[··] ${message}${NC}"
echo -e "${CYAN}[..] ${message}${NC}"
eval "$command" > "$log" 2>&1 &
local pid=$!
while kill -0 "$pid" 2>/dev/null; do
local temp=${spinstr#?}
printf "\r${MAGENTA}[%c·]${NC} ${message}" "$spinstr"
printf "\r${CYAN}[%c.]${NC} ${message}" "$spinstr"
spinstr=$temp${spinstr%"$temp"}
sleep 0.15
done
@@ -81,7 +153,7 @@ run_spinner() {
wait "$pid"
local exit_code=$?
if [ $exit_code -eq 0 ]; then
printf "\r${GREEN}[OK]${NC} ${message}\n"
printf "\r${CYAN}[OK]${NC} ${message}\n"
else
printf "\r${RED}[KO]${NC} ${message}\n"
fi
@@ -176,7 +248,7 @@ wait_for_apt() {
[ $wait_count -ge $max_wait ] && \
echo -e "${RED}[KO] Timeout waiting for package manager${NC}" && return 1
printf "\r${GRAY}[··] Waiting... (%ds/%ds)${NC}" $wait_count $max_wait
printf "\r${GRAY}[..] Waiting... (%ds/%ds)${NC}" $wait_count $max_wait
sleep 1
done
+18 -25
View File
@@ -120,15 +120,7 @@ check_remote_version() {
}
show_lxs_logo() {
local cols head tail_len
cols=$(tput cols 2>/dev/null || echo 64)
head=" L X S // v${LXS_VERSION} "
tail_len=$(( cols - ${#head} - 12 ))
[ "$tail_len" -lt 4 ] && tail_len=4
local bar
bar=$(printf '▀%.0s' $(seq 1 "$tail_len"))
echo ""
echo -e "${YELLOW}▀▀▀${WHITE}${BOLD}${head}${NC}${YELLOW}${bar}${NC} ${GREEN}[ONLINE]${NC}"
show_box_top "LXS // v${LXS_VERSION}" "ONLINE"
}
show_header() {
@@ -136,7 +128,8 @@ show_header() {
show_lxs_logo
if [ "${LXS_UPDATE_AVAILABLE:-0}" = "1" ]; then
echo -e "${YELLOW}▲ UPDATE_AVAILABLE :: v${LXS_REMOTE_VERSION}${NC} ${GRAY}// run \`lxs update\`${NC}"
echo ""
echo -e " ${CYAN}[!!] UPDATE_AVAILABLE${NC} ${WHITE}v${LXS_REMOTE_VERSION}${NC} ${GRAY}// run \`lxs update\`${NC}"
fi
local hostname os_version kernel uptime_info ip_address cpu_cores total_mem used_mem disk_usage
@@ -151,10 +144,10 @@ show_header() {
disk_usage=$(df -h / | awk 'NR==2 {print $3 "/" $2 " (" $5 ")"}')
echo ""
printf " ${CYAN}NODE${NC} %-22s ${CYAN}KERN${NC} %s\n" "$hostname" "$kernel"
printf " ${CYAN}ADDR${NC} %-22s ${CYAN}UP${NC} %s\n" "$ip_address" "$uptime_info"
printf " ${CYAN}OS${NC} %-22s ${CYAN}CPU${NC} %s cores\n" "$os_version" "$cpu_cores"
printf " ${CYAN}DISK${NC} %-22s ${CYAN}MEM${NC} %s / %s\n" "$disk_usage" "$used_mem" "$total_mem"
printf " ${CYAN}NODE${NC} ${WHITE}%-26s${NC} ${CYAN}KERN${NC} ${WHITE}%s${NC}\n" "$hostname" "$kernel"
printf " ${CYAN}ADDR${NC} ${WHITE}%-26s${NC} ${CYAN}UP${NC} ${WHITE}%s${NC}\n" "$ip_address" "$uptime_info"
printf " ${CYAN}OS${NC} ${WHITE}%-26s${NC} ${CYAN}CPU${NC} ${WHITE}%s cores${NC}\n" "$os_version" "$cpu_cores"
printf " ${CYAN}DISK${NC} ${WHITE}%-26s${NC} ${CYAN}MEM${NC} ${WHITE}%s / %s${NC}\n" "$disk_usage" "$used_mem" "$total_mem"
echo ""
}
@@ -197,7 +190,7 @@ download_and_run() {
temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh")
echo ""
echo -e "${MAGENTA}[··] Fetching ${BOLD}${script_name}${NC}${MAGENTA}...${NC}"
echo -e "${CYAN}[..] Fetching ${BOLD}${script_name}${NC}${CYAN}...${NC}"
if curl -fsSL -H "Cache-Control: no-cache" \
-o "${temp_file}" \
@@ -304,7 +297,7 @@ lxs_sync_install() {
}
trap 'rm -rf "$work"' RETURN
echo -e "${MAGENTA}[··] Fetching ${LXS_TARBALL_URL}...${NC}"
echo -e "${CYAN}[..] Fetching ${LXS_TARBALL_URL}...${NC}"
if ! curl -fsSL -H "Cache-Control: no-cache" -o "${work}/lxs.tgz" "$LXS_TARBALL_URL"; then
echo -e "${RED}[KO] Download failed${NC}"
return 1
@@ -372,18 +365,18 @@ cmd_install_self() {
main_menu() {
check_os
check_remote_version
local hostname
hostname=$(hostname 2>/dev/null || echo "${HOSTNAME:-node}")
while true; do
show_header
echo -e "${MAGENTA}>> SELECT_PROTOCOL <<${NC}"
show_box_mid "SELECT"
echo ""
echo -e " ${YELLOW}◢ 01${NC} ${GRAY}${NC} ${WHITE}APPLICATIONS${NC} ${GRAY}// deploy stacks${NC}"
echo -e " ${YELLOW}◢ 02${NC} ${GRAY}${NC} ${WHITE}TOOLS${NC} ${GRAY}// sysadmin daemons${NC}"
echo -e " ${YELLOW}◢ UU${NC} ${GRAY}${NC} ${WHITE}FETCH_UPDATE${NC} ${GRAY}// sync remote${NC}"
echo -e " ${RED}◢ 00${NC} ${GRAY}${NC} ${WHITE}JACK_OUT${NC} ${GRAY}// exit shell${NC}"
show_menu_item "01" "APPLICATIONS" "deploy stacks"
show_menu_item "02" "TOOLS" "sysadmin daemons"
show_menu_item "UU" "FETCH_UPDATE" "sync remote"
show_menu_item "00" "JACK_OUT" "exit shell" exit
echo ""
echo -e -n "${MAGENTA}jack_in${NC}@${CYAN}${hostname}${NC} ${YELLOW}${NC}${MAGENTA}_${NC} "
show_box_bottom
echo ""
show_prompt
read -r choice
case $choice in
@@ -399,7 +392,7 @@ main_menu() {
0|00)
clear
show_lxs_logo
echo -e "${MAGENTA}JACK_OUT${NC} ${GRAY}// session terminated${NC}\n"
echo -e "${CYAN}JACK_OUT${NC} ${GRAY}// session terminated${NC}\n"
exit 0
;;
*) echo -e "${RED}[KO] Invalid protocol.${NC}"; sleep 1 ;;
+13 -11
View File
@@ -35,7 +35,7 @@ run_sibling() {
local temp_file exit_code
temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh")
echo -e "${MAGENTA}[··] Fetching ${BOLD}${script_name}${NC}${MAGENTA}...${NC}"
echo -e "${CYAN}[..] Fetching ${BOLD}${script_name}${NC}${CYAN}...${NC}"
if curl -fsSL -H "Cache-Control: no-cache" -o "${temp_file}" "${LXS_RAW_BASE}/${script_path}"; then
echo -e "${GREEN}[OK] Payload acquired${NC}"
chmod +x "${temp_file}"
@@ -53,18 +53,20 @@ run_sibling() {
menu_tools() {
while true; do
clear
show_title "TOOLS" "SYS_DAEMONS"
show_box_top "TOOLS" "SYS_DAEMONS"
echo ""
echo -e " ${YELLOW}◢ 01${NC} ${GRAY}${NC} ${WHITE}System Infos${NC}"
echo -e " ${YELLOW}◢ 02${NC} ${GRAY}${NC} ${WHITE}Server Benchmark${NC}"
echo -e " ${YELLOW}◢ 03${NC} ${GRAY}${NC} ${WHITE}Harden Server${NC}"
echo -e " ${YELLOW}◢ 04${NC} ${GRAY}${NC} ${WHITE}Change Root Password${NC}"
echo -e " ${YELLOW}◢ 05${NC} ${GRAY}${NC} ${WHITE}Update Server${NC}"
echo -e " ${YELLOW}◢ 06${NC} ${GRAY}${NC} ${WHITE}Root SSH Password Login${NC}"
echo -e " ${YELLOW}◢ 07${NC} ${GRAY}${NC} ${WHITE}Welcome Message (MOTD)${NC}"
echo -e " ${RED}◢ 00${NC} ${GRAY}${NC} ${WHITE}BACK${NC}"
show_menu_item "01" "System Infos"
show_menu_item "02" "Server Benchmark"
show_menu_item "03" "Harden Server"
show_menu_item "04" "Change Root Password"
show_menu_item "05" "Update Server"
show_menu_item "06" "Root SSH Password Login"
show_menu_item "07" "Welcome Message (MOTD)"
show_menu_item "00" "BACK" "" exit
echo ""
echo -e -n "${YELLOW}${NC}${MAGENTA}_${NC} "
show_box_bottom
echo ""
show_prompt
read -r choice
case $choice in