Skip to content

Commit

Permalink
Add:script for color test
Browse files Browse the repository at this point in the history
  • Loading branch information
bamjun committed May 12, 2024
1 parent 061cd94 commit a30c161
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 1 deletion.
83 changes: 83 additions & 0 deletions COLOR_TEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash

# 색상 초기화
COLOR_RESET="\033[0m"

# 일반 색상과 색상 코드
# declare -A colors
# colors=(
# [COLOR_BLACK]="\033[0;30m"
# [COLOR_RED]="\033[0;31m"
# [COLOR_GREEN]="\033[0;32m"
# [COLOR_YELLOW]="\033[0;33m"
# [COLOR_BLUE]="\033[0;34m"
# [COLOR_MAGENTA]="\033[0;35m"
# [COLOR_CYAN]="\033[0;36m"
# )

# # 색상 출력
# for color_name in "${!colors[@]}"; do
# color_code="${colors[$color_name]}"
# echo -e "${color_code}This is $color_name ${COLOR_RESET}"
# echo "$color_name: ${colors[$color_name]}"
# done


# echo ""
# echo ""

for ((i=0; i<=255; i++)) do


if (( i == 0 )); then
select_color="\033[38;5;${i}m"
back="\033[48;5;${i}m"
echo -en "${select_color}This is select_color${back}"
echo -n "${select_color} ${back}"
echo -en "${COLOR_RESET}"
echo ""
echo ""
fi
if (( i % 3 == 0 && i != 0 )); then
select_color="\033[38;5;$((i-2))m"
back="\033[48;5;$((i-2))m"
echo -en "${select_color}This is select_color${back}"
echo -n "${select_color} ${back}"
echo -en "${COLOR_RESET}"

select_color="\033[38;5;$((i-1))m"
back="\033[48;5;$((i-1))m"
echo -en "${select_color}This is select_color${back}"
echo -n "${select_color} ${back}"
echo -en "${COLOR_RESET}"

select_color="\033[38;5;${i}m"
back="\033[48;5;${i}m"
echo -en "${select_color}This is select_color${back}"
echo -n "${select_color} ${back}"
echo -en "${COLOR_RESET}"

echo ""

select_color="\033[38;5;$((i-2))m"
back="\033[48;5;$((i-2))m"
echo -en "${select_color}This is select_color${back}"
echo -n "${select_color} ${back}"
echo -en "${COLOR_RESET}"

select_color="\033[38;5;$((i-1))m"
back="\033[48;5;$((i-1))m"
echo -en "${select_color}This is select_color${back}"
echo -n "${select_color} ${back}"
echo -en "${COLOR_RESET}"

select_color="\033[38;5;${i}m"
back="\033[48;5;${i}m"
echo -en "${select_color}This is select_color${back}"
echo -n "${select_color} ${back}"
echo -en "${COLOR_RESET}"

echo ""
echo ""
fi
done
3 changes: 3 additions & 0 deletions UP_VERSION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 0.0.1
- 레포지토리 버전과 틀리면 다운받을지 선택하는 기능.
- 레포지토리에서 덮어쓰기하면서 받을때 실행중인 스크립트 경로에 다운받음.
13 changes: 12 additions & 1 deletion up
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

version_index="0.0.1"


# 버전 체크
if [ "$1" = "check_version" ]; then
echo "$version_index"
Expand All @@ -12,7 +13,17 @@ github_repo_version=$(curl -s "https://bamjun.github.io/q/up" | bash -s -- check

if [ "$version_index" != "$github_repo_version" ]; then
echo "레포지토리 버전과 틀립니다."
exit
echo "1 : 레포지토리 버전으로 덮어쓰기"
echo "2 : 그냥 종료"
echo "3 : 기존 스크립트 실행"
read choose_index
if [ "$choose_index" == "1" ]; then
script_path=$(realpath "$0")
curl -o $script_path "https://bamjun.github.io/q/up"
exit
elif [ "$choose_index" == "2" ]; then
exit
fi
fi


Expand Down

0 comments on commit a30c161

Please sign in to comment.