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 local temp_file exit_code
temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh") 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 if curl -fsSL -H "Cache-Control: no-cache" -o "${temp_file}" "${LXS_RAW_BASE}/${script_path}"; then
echo -e "${GREEN}[OK] Payload acquired${NC}" echo -e "${GREEN}[OK] Payload acquired${NC}"
chmod +x "${temp_file}" chmod +x "${temp_file}"
@@ -52,16 +52,18 @@ run_sibling() {
menu_apps() { menu_apps() {
while true; do while true; do
clear clear
show_title "APPLICATIONS" "APP_REPOSITORY" show_box_top "APPLICATIONS" "APP_REPOSITORY"
echo "" echo ""
echo -e " ${YELLOW}◢ 01${NC} ${GRAY}${NC} ${WHITE}Coolify${NC}" show_menu_item "01" "Coolify"
echo -e " ${YELLOW}◢ 02${NC} ${GRAY}${NC} ${WHITE}Pterodactyl Panel${NC}" show_menu_item "02" "Pterodactyl Panel"
echo -e " ${YELLOW}◢ 03${NC} ${GRAY}${NC} ${WHITE}Uptime Kuma${NC}" show_menu_item "03" "Uptime Kuma"
echo -e " ${YELLOW}◢ 04${NC} ${GRAY}${NC} ${WHITE}CloudPanel${NC}" show_menu_item "04" "CloudPanel"
echo -e " ${YELLOW}◢ 05${NC} ${GRAY}${NC} ${WHITE}Proxmox VE Tools${NC}" show_menu_item "05" "Proxmox VE Tools"
echo -e " ${RED}◢ 00${NC} ${GRAY}${NC} ${WHITE}BACK${NC}" show_menu_item "00" "BACK" "" exit
echo "" echo ""
echo -e -n "${YELLOW}${NC}${MAGENTA}_${NC} " show_box_bottom
echo ""
show_prompt
read -r choice read -r choice
case $choice in case $choice in
+99 -27
View File
@@ -7,46 +7,118 @@
# Repo: https://git.hyko.cx/hykocx/lxs # 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 RED='\033[38;2;255;64;64m' # errors, destructive actions
GREEN='\033[1;92m' # phosphor green CYAN='\033[38;2;0;229;255m' # accents, titles, OK, info
YELLOW='\033[1;93m' # signature electric yellow WHITE='\033[38;2;240;240;240m' # primary text
MAGENTA='\033[1;95m' # hot pink neon GRAY='\033[38;2;140;140;140m' # secondary text, comments, separators
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
NC='\033[0m' NC='\033[0m'
BOLD='\033[1m' BOLD='\033[1m'
DIM='\033[2m' 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() { show_separator() {
local cols _lxs_hr "$(_lxs_term_cols)"
cols=$(tput cols 2>/dev/null || echo 64) }
printf "${YELLOW}"
printf '▀%.0s' $(seq 1 "$cols") _lxs_hr() {
printf "${NC}\n" local cols=$1 fill
fill=$(printf '─%.0s' $(seq 1 "$cols"))
printf "${GRAY}%s${NC}\n" "$fill"
} }
show_title() { show_title() {
local title="$1" local title="$1"
local subtitle="${2:-SYS_MODULE}" local subtitle="${2:-}"
echo "" echo ""
echo -e "${YELLOW}${REV} ${title} ${NC} ${MAGENTA}// ${subtitle}${NC}" if [ -n "$subtitle" ]; then
show_separator show_box_top "$title" "$subtitle"
else
show_box_top "$title"
fi
} }
info() { echo -e "${MAGENTA}[··]${NC} $*"; } # Render a menu line. Pass "exit" as 4th arg to color the key red.
ok() { echo -e "${GREEN}[OK]${NC} $*"; } # show_menu_item "01" "APPLICATIONS" "deploy stacks"
warn() { echo -e "${YELLOW}[!!]${NC} $*"; } # 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; } err() { echo -e "${RED}[KO]${NC} $*" >&2; }
# ═══════════════════════════════════════════════════════════════════════════ # ═══════════════════════════════════════════════════════════════════════════
@@ -67,13 +139,13 @@ run_spinner() {
local spinstr='|/-\' local spinstr='|/-\'
local log="${LXS_LOG_FILE:-/tmp/lxs.log}" local log="${LXS_LOG_FILE:-/tmp/lxs.log}"
echo -e "${MAGENTA}[··] ${message}${NC}" echo -e "${CYAN}[..] ${message}${NC}"
eval "$command" > "$log" 2>&1 & eval "$command" > "$log" 2>&1 &
local pid=$! local pid=$!
while kill -0 "$pid" 2>/dev/null; do while kill -0 "$pid" 2>/dev/null; do
local temp=${spinstr#?} local temp=${spinstr#?}
printf "\r${MAGENTA}[%c·]${NC} ${message}" "$spinstr" printf "\r${CYAN}[%c.]${NC} ${message}" "$spinstr"
spinstr=$temp${spinstr%"$temp"} spinstr=$temp${spinstr%"$temp"}
sleep 0.15 sleep 0.15
done done
@@ -81,7 +153,7 @@ run_spinner() {
wait "$pid" wait "$pid"
local exit_code=$? local exit_code=$?
if [ $exit_code -eq 0 ]; then if [ $exit_code -eq 0 ]; then
printf "\r${GREEN}[OK]${NC} ${message}\n" printf "\r${CYAN}[OK]${NC} ${message}\n"
else else
printf "\r${RED}[KO]${NC} ${message}\n" printf "\r${RED}[KO]${NC} ${message}\n"
fi fi
@@ -176,7 +248,7 @@ wait_for_apt() {
[ $wait_count -ge $max_wait ] && \ [ $wait_count -ge $max_wait ] && \
echo -e "${RED}[KO] Timeout waiting for package manager${NC}" && return 1 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 sleep 1
done done
+18 -25
View File
@@ -120,15 +120,7 @@ check_remote_version() {
} }
show_lxs_logo() { show_lxs_logo() {
local cols head tail_len show_box_top "LXS // v${LXS_VERSION}" "ONLINE"
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_header() { show_header() {
@@ -136,7 +128,8 @@ show_header() {
show_lxs_logo show_lxs_logo
if [ "${LXS_UPDATE_AVAILABLE:-0}" = "1" ]; then 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 fi
local hostname os_version kernel uptime_info ip_address cpu_cores total_mem used_mem disk_usage 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 ")"}') disk_usage=$(df -h / | awk 'NR==2 {print $3 "/" $2 " (" $5 ")"}')
echo "" echo ""
printf " ${CYAN}NODE${NC} %-22s ${CYAN}KERN${NC} %s\n" "$hostname" "$kernel" printf " ${CYAN}NODE${NC} ${WHITE}%-26s${NC} ${CYAN}KERN${NC} ${WHITE}%s${NC}\n" "$hostname" "$kernel"
printf " ${CYAN}ADDR${NC} %-22s ${CYAN}UP${NC} %s\n" "$ip_address" "$uptime_info" printf " ${CYAN}ADDR${NC} ${WHITE}%-26s${NC} ${CYAN}UP${NC} ${WHITE}%s${NC}\n" "$ip_address" "$uptime_info"
printf " ${CYAN}OS${NC} %-22s ${CYAN}CPU${NC} %s cores\n" "$os_version" "$cpu_cores" printf " ${CYAN}OS${NC} ${WHITE}%-26s${NC} ${CYAN}CPU${NC} ${WHITE}%s cores${NC}\n" "$os_version" "$cpu_cores"
printf " ${CYAN}DISK${NC} %-22s ${CYAN}MEM${NC} %s / %s\n" "$disk_usage" "$used_mem" "$total_mem" printf " ${CYAN}DISK${NC} ${WHITE}%-26s${NC} ${CYAN}MEM${NC} ${WHITE}%s / %s${NC}\n" "$disk_usage" "$used_mem" "$total_mem"
echo "" echo ""
} }
@@ -197,7 +190,7 @@ download_and_run() {
temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh") temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh")
echo "" 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" \ if curl -fsSL -H "Cache-Control: no-cache" \
-o "${temp_file}" \ -o "${temp_file}" \
@@ -304,7 +297,7 @@ lxs_sync_install() {
} }
trap 'rm -rf "$work"' RETURN 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 if ! curl -fsSL -H "Cache-Control: no-cache" -o "${work}/lxs.tgz" "$LXS_TARBALL_URL"; then
echo -e "${RED}[KO] Download failed${NC}" echo -e "${RED}[KO] Download failed${NC}"
return 1 return 1
@@ -372,18 +365,18 @@ cmd_install_self() {
main_menu() { main_menu() {
check_os check_os
check_remote_version check_remote_version
local hostname
hostname=$(hostname 2>/dev/null || echo "${HOSTNAME:-node}")
while true; do while true; do
show_header show_header
echo -e "${MAGENTA}>> SELECT_PROTOCOL <<${NC}" show_box_mid "SELECT"
echo "" echo ""
echo -e " ${YELLOW}◢ 01${NC} ${GRAY}${NC} ${WHITE}APPLICATIONS${NC} ${GRAY}// deploy stacks${NC}" show_menu_item "01" "APPLICATIONS" "deploy stacks"
echo -e " ${YELLOW}◢ 02${NC} ${GRAY}${NC} ${WHITE}TOOLS${NC} ${GRAY}// sysadmin daemons${NC}" show_menu_item "02" "TOOLS" "sysadmin daemons"
echo -e " ${YELLOW}◢ UU${NC} ${GRAY}${NC} ${WHITE}FETCH_UPDATE${NC} ${GRAY}// sync remote${NC}" show_menu_item "UU" "FETCH_UPDATE" "sync remote"
echo -e " ${RED}◢ 00${NC} ${GRAY}${NC} ${WHITE}JACK_OUT${NC} ${GRAY}// exit shell${NC}" show_menu_item "00" "JACK_OUT" "exit shell" exit
echo "" echo ""
echo -e -n "${MAGENTA}jack_in${NC}@${CYAN}${hostname}${NC} ${YELLOW}${NC}${MAGENTA}_${NC} " show_box_bottom
echo ""
show_prompt
read -r choice read -r choice
case $choice in case $choice in
@@ -399,7 +392,7 @@ main_menu() {
0|00) 0|00)
clear clear
show_lxs_logo 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 exit 0
;; ;;
*) echo -e "${RED}[KO] Invalid protocol.${NC}"; sleep 1 ;; *) echo -e "${RED}[KO] Invalid protocol.${NC}"; sleep 1 ;;
+13 -11
View File
@@ -35,7 +35,7 @@ run_sibling() {
local temp_file exit_code local temp_file exit_code
temp_file=$(mktemp "/tmp/lxs.${script_name%.*}.XXXXXX.sh") 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 if curl -fsSL -H "Cache-Control: no-cache" -o "${temp_file}" "${LXS_RAW_BASE}/${script_path}"; then
echo -e "${GREEN}[OK] Payload acquired${NC}" echo -e "${GREEN}[OK] Payload acquired${NC}"
chmod +x "${temp_file}" chmod +x "${temp_file}"
@@ -53,18 +53,20 @@ run_sibling() {
menu_tools() { menu_tools() {
while true; do while true; do
clear clear
show_title "TOOLS" "SYS_DAEMONS" show_box_top "TOOLS" "SYS_DAEMONS"
echo "" echo ""
echo -e " ${YELLOW}◢ 01${NC} ${GRAY}${NC} ${WHITE}System Infos${NC}" show_menu_item "01" "System Infos"
echo -e " ${YELLOW}◢ 02${NC} ${GRAY}${NC} ${WHITE}Server Benchmark${NC}" show_menu_item "02" "Server Benchmark"
echo -e " ${YELLOW}◢ 03${NC} ${GRAY}${NC} ${WHITE}Harden Server${NC}" show_menu_item "03" "Harden Server"
echo -e " ${YELLOW}◢ 04${NC} ${GRAY}${NC} ${WHITE}Change Root Password${NC}" show_menu_item "04" "Change Root Password"
echo -e " ${YELLOW}◢ 05${NC} ${GRAY}${NC} ${WHITE}Update Server${NC}" show_menu_item "05" "Update Server"
echo -e " ${YELLOW}◢ 06${NC} ${GRAY}${NC} ${WHITE}Root SSH Password Login${NC}" show_menu_item "06" "Root SSH Password Login"
echo -e " ${YELLOW}◢ 07${NC} ${GRAY}${NC} ${WHITE}Welcome Message (MOTD)${NC}" show_menu_item "07" "Welcome Message (MOTD)"
echo -e " ${RED}◢ 00${NC} ${GRAY}${NC} ${WHITE}BACK${NC}" show_menu_item "00" "BACK" "" exit
echo "" echo ""
echo -e -n "${YELLOW}${NC}${MAGENTA}_${NC} " show_box_bottom
echo ""
show_prompt
read -r choice read -r choice
case $choice in case $choice in