Compare commits
2 Commits
bd3a592b70
...
7fdb33edb5
Author | SHA1 | Date | |
---|---|---|---|
7fdb33edb5 | |||
a7c0ec2280 |
1
colorschemes/active.main
Symbolic link
1
colorschemes/active.main
Symbolic link
@ -0,0 +1 @@
|
||||
/home/w0ryn/.wryn/colorschemes/christmas.conf
|
26
colorschemes/active.main.alacritty
Normal file
26
colorschemes/active.main.alacritty
Normal file
@ -0,0 +1,26 @@
|
||||
--- # yamllint disable rule:colons
|
||||
# do not edit; generated by scwrypts
|
||||
colors:
|
||||
primary:
|
||||
background: '0x000505'
|
||||
foreground: '0xCCDDFF'
|
||||
cursor:
|
||||
cursor: '0x46FFB6'
|
||||
normal:
|
||||
black: '0x22262B'
|
||||
red: '0xA2152D'
|
||||
green: '0x288B52'
|
||||
yellow: '0x489358'
|
||||
blue: '0x0EA1EE'
|
||||
magenta: '0xA03C6F'
|
||||
cyan: '0x8195A2'
|
||||
white: '0x486A8A'
|
||||
bright:
|
||||
black: '0x3D444E'
|
||||
red: '0xFF1440'
|
||||
green: '0x55C9B5'
|
||||
yellow: '0x5BF887'
|
||||
blue: '0x00FFFF'
|
||||
magenta: '0xCF4663'
|
||||
cyan: '0xDFF5FE'
|
||||
white: '0xEBFFF2'
|
7
colorschemes/active.main.getty
Normal file
7
colorschemes/active.main.getty
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
# source this file to apply colorscheme to linux getty
|
||||
[[ "$TERM" =~ ^linux$ ]] || return 0
|
||||
|
||||
/bin/echo -e " ]P0000505 ]P1A2152D ]P2288B52 ]P3489358 ]P40EA1EE ]P5A03C6F ]P68195A2 ]P7CCDDFF ]P8FF1440 ]P955C9B5 ]PA5BF887 ]PB00FFFF ]PCCF4663 ]PDDFF5FE ]PE486A8A ]PFEBFFF2 "
|
||||
[ ! $NO_CLEAR ] && clear
|
||||
return 0
|
@ -1 +0,0 @@
|
||||
purple.conf
|
@ -1 +0,0 @@
|
||||
christmas.conf
|
@ -6,9 +6,11 @@ use desktop/colorscheme --group dotwryn
|
||||
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
SET_THEME alternate
|
||||
i3-sensible-terminal &
|
||||
PID=$!
|
||||
sleep 0.1
|
||||
SET_THEME main
|
||||
wait $!
|
||||
|
||||
MAIN() {
|
||||
unset USAGE
|
||||
GET_COLORSCHEME_HEX $@
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
MAIN $@
|
@ -7,4 +7,10 @@ use desktop/colorscheme --group dotwryn
|
||||
CHECK_ENVIRONMENT
|
||||
#####################################################################
|
||||
|
||||
GET_COLORSCHEME_HEX $@
|
||||
MAIN() {
|
||||
unset USAGE
|
||||
SET_THEME $@
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
MAIN $@
|
@ -1,27 +1,261 @@
|
||||
#####################################################################
|
||||
|
||||
DEPENDENCIES+=(
|
||||
awk sed tr
|
||||
)
|
||||
DEPENDENCIES+=(awk sed tr)
|
||||
REQUIRED_ENV+=()
|
||||
|
||||
#####################################################################
|
||||
|
||||
GET_COLORSCHEME_HEX() {
|
||||
[ $1 ] && [[ $1 -le 15 ]] && [[ $1 -ge 0 ]] \
|
||||
|| FAIL 1 'must provide ANSI color number 0-15'
|
||||
_COLORSCHEME_DIR="$DOTWRYN/colorschemes"
|
||||
|
||||
grep "^color$1 " "$DOTWRYN/colorschemes/kitty.main" \
|
||||
ACTIVE_THEME_NAME='main'
|
||||
ACTIVE_THEME="$_COLORSCHEME_DIR/active.$ACTIVE_THEME_NAME"
|
||||
|
||||
GET_COLORSCHEME_HEX() {
|
||||
[ ! $USAGE ] && USAGE="
|
||||
usage: ...args... [...options...]
|
||||
|
||||
options:
|
||||
-h, --help show this dialogue and exit
|
||||
|
||||
args:
|
||||
\$1 [0-15] gets the indicated color by ANSI color number
|
||||
background gets the background color
|
||||
foreground gets the foreground color
|
||||
cursor gets the cursor color
|
||||
all sets all theme variables (returns nothing)
|
||||
"
|
||||
|
||||
local ARGS=()
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
case $1 in
|
||||
-h | --help ) USAGE; return 0;;
|
||||
|
||||
all ) ARGS=(all); break ;;
|
||||
|
||||
* ) ARGS+=($1) ;;
|
||||
esac
|
||||
shift 1
|
||||
done
|
||||
|
||||
[[ ${#ARGS[@]} -gt 0 ]] || ERROR 'must provide at least one color lookup'
|
||||
|
||||
CHECK_ERRORS || return 1
|
||||
|
||||
##########################################
|
||||
|
||||
local PATTERN
|
||||
|
||||
for A in ${ARGS[@]}
|
||||
do
|
||||
case $A in
|
||||
all )
|
||||
FOREGROUND=$(GET_COLORSCHEME_HEX foreground)
|
||||
BACKGROUND=$(GET_COLORSCHEME_HEX background)
|
||||
|
||||
CURSOR=$(GET_COLORSCHEME_HEX cursor)
|
||||
|
||||
BLACK=$(GET_COLORSCHEME_HEX 0)
|
||||
RED=$(GET_COLORSCHEME_HEX 1)
|
||||
GREEN=$(GET_COLORSCHEME_HEX 2)
|
||||
YELLOW=$(GET_COLORSCHEME_HEX 3)
|
||||
BLUE=$(GET_COLORSCHEME_HEX 4)
|
||||
MAGENTA=$(GET_COLORSCHEME_HEX 5)
|
||||
CYAN=$(GET_COLORSCHEME_HEX 6)
|
||||
WHITE=$(GET_COLORSCHEME_HEX 7)
|
||||
|
||||
BRIGHT_BLACK=$(GET_COLORSCHEME_HEX 8 )
|
||||
BRIGHT_RED=$(GET_COLORSCHEME_HEX 9 )
|
||||
BRIGHT_GREEN=$(GET_COLORSCHEME_HEX 10)
|
||||
BRIGHT_YELLOW=$(GET_COLORSCHEME_HEX 11)
|
||||
BRIGHT_BLUE=$(GET_COLORSCHEME_HEX 12)
|
||||
BRIGHT_MAGENTA=$(GET_COLORSCHEME_HEX 13)
|
||||
BRIGHT_CYAN=$(GET_COLORSCHEME_HEX 14)
|
||||
BRIGHT_WHITE=$(GET_COLORSCHEME_HEX 15)
|
||||
|
||||
return 0
|
||||
;;
|
||||
|
||||
foreground | background | cursor ) PATTERN="^$A " ;;
|
||||
|
||||
* ) : \
|
||||
&& [ $A ] && [[ $A -le 15 ]] && [[ $A -ge 0 ]] \
|
||||
|| { ERROR 'must provide ANSI color number 0-15'; return 1; }
|
||||
|
||||
PATTERN="^color$A "
|
||||
;;
|
||||
esac
|
||||
|
||||
grep "$PATTERN" "$ACTIVE_THEME" \
|
||||
| awk '{print $2}' \
|
||||
| sed 's/ //g; s/#//g' \
|
||||
| tr '[:lower:]' '[:upper:]' \
|
||||
;
|
||||
done
|
||||
}
|
||||
|
||||
SET_THEME() {
|
||||
local THEME="$DOTWRYN/colorschemes/kitty.$1"
|
||||
[ ! -f "$THEME" ] && FAIL 1 "no such theme '$1'"
|
||||
local LOCAL_THEME="$HOME/.config/kitty/theme.conf"
|
||||
rm -- $LOCAL_THEME
|
||||
ln -s "$THEME" "$LOCAL_THEME"
|
||||
[ ! $USAGE ] && USAGE="
|
||||
usage: [...options...]
|
||||
|
||||
options:
|
||||
-t, --theme one of the available color themes
|
||||
-l, --list-themes show available color themes and exit
|
||||
|
||||
--only only set the theme for a specific terminal (alacritty kitty tty)
|
||||
|
||||
-h, --help show this dialogue and exit
|
||||
|
||||
generate all source-controlled theme files then link them to the
|
||||
appropriate local theme file to immediately update terminal themes
|
||||
"
|
||||
local SOURCE_THEME EMULATOR
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
case $1 in
|
||||
-t | --theme ) THEME_NAME=$2; shift 1 ;;
|
||||
|
||||
-l | --list-themes ) _LIST_THEMES; return 0 ;;
|
||||
|
||||
--only )
|
||||
EMULATOR=$2; shift 1
|
||||
command -v _SET_THEME__$EMULATOR >/dev/null 2>&1 \
|
||||
|| ERROR "terminal emulator '$EMULATOR' not supported"
|
||||
;;
|
||||
|
||||
-h | --help ) USAGE; return 0 ;;
|
||||
|
||||
* ) ERROR "unknown argument '$1'"
|
||||
esac
|
||||
shift 1
|
||||
done
|
||||
|
||||
CHECK_ERRORS || return 1
|
||||
|
||||
##########################################
|
||||
|
||||
[ $THEME_NAME ] || THEME_NAME=$(_LIST_THEMES | FZF 'select a theme')
|
||||
[ $THEME_NAME ] || ABORT
|
||||
|
||||
local THEME="$_COLORSCHEME_DIR/$THEME_NAME.conf"
|
||||
[ -f "$THEME" ] || FAIL 1 "no such theme '$THEME_NAME'"
|
||||
|
||||
|
||||
##########################################
|
||||
|
||||
STATUS "updating theme $ACTIVE_THEME_NAME" \
|
||||
&& ln -sf "$THEME" "$ACTIVE_THEME" \
|
||||
&& SUCCESS "theme $ACTIVE_THEME_NAME set to '$THEME_NAME'" \
|
||||
|| FAIL 2 "unable to set theme $ACTIVE_THEME_NAME to '$THEME_NAME'"
|
||||
|
||||
local EMULATORS=(alacritty kitty getty)
|
||||
[ $EMULATOR ] && EMULATORS=($EMULATOR)
|
||||
|
||||
GET_COLORSCHEME_HEX all
|
||||
for EMULATOR in ${EMULATORS[@]}
|
||||
do
|
||||
STATUS "updating $EMULATOR theme to use $ACTIVE_THEME_NAME" \
|
||||
&& _GENERATE_THEME__$EMULATOR \
|
||||
&& _SET_THEME__$EMULATOR \
|
||||
&& SUCCESS "emulator $EMULATOR successfully set to $ACTIVE_THEME_NAME" \
|
||||
|| ERROR "error setting theme $ACTIVE_THEME_NAME for $EMULATOR"
|
||||
|
||||
[[ $EMULATOR =~ ^getty$ ]] && [[ $TERM =~ ^linux$ ]] && {
|
||||
STATUS 'loading getty theme now' \
|
||||
&& NO_CLEAR=1 source "$ACTIVE_THEME.getty" \
|
||||
&& SUCCESS 'getty theme loaded' \
|
||||
|| ERROR 'getty theme loading error (see above)'
|
||||
}
|
||||
done
|
||||
|
||||
CHECK_ERRORS --no-usage
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
|
||||
_LIST_THEMES() {
|
||||
ls "$_COLORSCHEME_DIR" | grep '.conf$' | sed 's/.conf$//'
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
|
||||
_GENERATE_THEME__alacritty() {
|
||||
STATUS "generating $ACTIVE_THEME_NAME.alacritty"
|
||||
echo "--- # yamllint disable rule:colons
|
||||
# do not edit; generated by scwrypts
|
||||
colors:
|
||||
primary:
|
||||
background: '0x$BACKGROUND'
|
||||
foreground: '0x$FOREGROUND'
|
||||
cursor:
|
||||
cursor: '0x$CURSOR'
|
||||
normal:
|
||||
black: '0x$BLACK'
|
||||
red: '0x$RED'
|
||||
green: '0x$GREEN'
|
||||
yellow: '0x$YELLOW'
|
||||
blue: '0x$BLUE'
|
||||
magenta: '0x$MAGENTA'
|
||||
cyan: '0x$CYAN'
|
||||
white: '0x$WHITE'
|
||||
bright:
|
||||
black: '0x$BRIGHT_BLACK'
|
||||
red: '0x$BRIGHT_RED'
|
||||
green: '0x$BRIGHT_GREEN'
|
||||
yellow: '0x$BRIGHT_YELLOW'
|
||||
blue: '0x$BRIGHT_BLUE'
|
||||
magenta: '0x$BRIGHT_MAGENTA'
|
||||
cyan: '0x$BRIGHT_CYAN'
|
||||
white: '0x$BRIGHT_WHITE'
|
||||
" | sed '$d' > "$ACTIVE_THEME.alacritty"
|
||||
}
|
||||
|
||||
_SET_THEME__alacritty() {
|
||||
local LOCAL_THEME="$HOME/.config/alacritty/theme.yml"
|
||||
ln -sf "$ACTIVE_THEME.alacritty" "$LOCAL_THEME"
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
|
||||
_GENERATE_THEME__kitty() {
|
||||
return 0 # existing theme is compatible with kitty
|
||||
}
|
||||
|
||||
_SET_THEME__kitty() {
|
||||
local LOCAL_THEME="$HOME/.config/kitty/theme.conf"
|
||||
ln -sf "$ACTIVE_THEME" "$LOCAL_THEME"
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
|
||||
_GENERATE_THEME__getty() {
|
||||
echo "#!/bin/sh
|
||||
# source this file to apply colorscheme to linux getty
|
||||
[[ \"\$TERM\" =~ ^linux$ ]] || return 0
|
||||
|
||||
/bin/echo -e \" \
|
||||
\\e]P0$BACKGROUND \
|
||||
\\e]P1$RED \
|
||||
\\e]P2$GREEN \
|
||||
\\e]P3$YELLOW \
|
||||
\\e]P4$BLUE \
|
||||
\\e]P5$MAGENTA \
|
||||
\\e]P6$CYAN \
|
||||
\\e]P7$FOREGROUND \
|
||||
\\e]P8$BRIGHT_RED \
|
||||
\\e]P9$BRIGHT_GREEN \
|
||||
\\e]PA$BRIGHT_YELLOW \
|
||||
\\e]PB$BRIGHT_BLUE \
|
||||
\\e]PC$BRIGHT_MAGENTA \
|
||||
\\e]PD$BRIGHT_CYAN \
|
||||
\\e]PE$WHITE \
|
||||
\\e]PF$BRIGHT_WHITE \
|
||||
\"
|
||||
[ ! \$NO_CLEAR ] && clear
|
||||
return 0" > "$ACTIVE_THEME.getty"
|
||||
}
|
||||
|
||||
_SET_THEME__getty() {
|
||||
local LOCAL_THEME="$HOME/.config/wryn/tty-colorscheme"
|
||||
ln -sf "$ACTIVE_THEME.getty" "$LOCAL_THEME"
|
||||
}
|
||||
|
79
zsh/colors
79
zsh/colors
@ -3,82 +3,7 @@
|
||||
|
||||
alias ls='ls --color=auto --group-directories-first'
|
||||
|
||||
#####################################################################
|
||||
|
||||
_TTY_LOAD_COLORSCHEME() {
|
||||
[[ "$TERM" =~ ^linux$ ]] || return 0
|
||||
|
||||
local TARGET="$HOME/.config/wryn/tty-colorscheme"
|
||||
[ ! -f $TARGET ] && TARGET="$DOTWRYN/colorschemes/kitty.main"
|
||||
|
||||
local PARSE() {
|
||||
grep "$1" $TARGET | awk '{print $2}' | sed 's/ //g; s/#//g' | tr '[:lower:]' '[:upper:]'
|
||||
}
|
||||
|
||||
/bin/echo -e "\
|
||||
\e]P0$(PARSE '^background ')
|
||||
\e]P1$(PARSE '^color1 ')
|
||||
\e]P2$(PARSE '^color2 ')
|
||||
\e]P3$(PARSE '^color3 ')
|
||||
\e]P4$(PARSE '^color4 ')
|
||||
\e]P5$(PARSE '^color5 ')
|
||||
\e]P6$(PARSE '^color6 ')
|
||||
\e]P7$(PARSE '^foreground ')
|
||||
\e]P8$(PARSE '^color9 ')
|
||||
\e]P9$(PARSE '^color10 ')
|
||||
\e]PA$(PARSE '^color11 ')
|
||||
\e]PB$(PARSE '^color12 ')
|
||||
\e]PC$(PARSE '^color13 ')
|
||||
\e]PD$(PARSE '^color14 ')
|
||||
\e]PE$(PARSE '^color7 ')
|
||||
\e]PF$(PARSE '^color15 ')
|
||||
"
|
||||
clear
|
||||
}
|
||||
_TTY_LOAD_COLORSCHEME
|
||||
|
||||
#####################################################################
|
||||
|
||||
alias kitty-change-colorscheme='CHANGE_COLORSCHEME kitty main'
|
||||
alias kitty-change-colorscheme-alternate='CHANGE_COLORSCHEME kitty alternate'
|
||||
alias tty-change-theme='CHANGE_COLORSCHEME tty'
|
||||
|
||||
CHANGE_COLORSCHEME () {
|
||||
local TYPE="$1"
|
||||
local TARGET_LINK EXTRA_OPTIONS
|
||||
case $TYPE in
|
||||
tty )
|
||||
TARGET_LINK="$HOME/.config/wryn/tty-colorscheme"
|
||||
EXTRA_OPTIONS=(default)
|
||||
;;
|
||||
kitty )
|
||||
TARGET_LINK="./kitty.$2"
|
||||
EXTRA_OPTIONS=()
|
||||
;;
|
||||
esac
|
||||
local COLORSCHEMES=($(cd $DOTWRYN/colorschemes; ls *.conf) $EXTRA_OPTIONS)
|
||||
local COLORSCHEME=$(\
|
||||
echo $COLORSCHEMES | sed 's/\s\+/\n/g' | sort -u \
|
||||
| sed 's/\.conf//g; s/^./\U&/; s/-\(.\)/\U\1/g; s/^Default/& (use kitty theme)/' \
|
||||
| fzf -i --height=50% --reverse --prompt 'select a theme : ' \
|
||||
| sed 's/^./\L&/; s/[A-Z]/-\L&/g'
|
||||
)
|
||||
|
||||
cd "$DOTWRYN/colorschemes/"
|
||||
case $COLORSCHEME in
|
||||
'' ) return 1 ;;
|
||||
default* ) ;;
|
||||
* )
|
||||
COLORSCHEME="$COLORSCHEME.conf"
|
||||
[ ! -f $COLORSCHEME ] && { echo "no such theme">&2; return 2; }
|
||||
;;
|
||||
esac
|
||||
|
||||
rm -- $TARGET_LINK >/dev/null 2>&1
|
||||
ln -s $COLORSCHEME $TARGET_LINK
|
||||
|
||||
echo "'$TYPE' theme changed successfully! (effective on new session)"
|
||||
_TTY_LOAD_COLORSCHEME
|
||||
}
|
||||
[ -f "$HOME/.config/wryn/tty-colorscheme" ] \
|
||||
&& source "$HOME/.config/wryn/tty-colorscheme"
|
||||
|
||||
#####################################################################
|
||||
|
5
zsh/rc
5
zsh/rc
@ -43,4 +43,9 @@ WELCOME
|
||||
echo $PATH | grep -q "^\\(.*:\\|\\)$HOME/.local/bin\\(:.*\\|\\)$" \
|
||||
|| export PATH="$HOME/.local/bin:$PATH"
|
||||
#####################################################################
|
||||
|
||||
[[ $TERM =~ alacritty ]] \
|
||||
&& [[ $(xdotool search --classname Alacritty 2>/dev/null | wc -l) -eq 1 ]] \
|
||||
&& scwrypts tmux omni
|
||||
|
||||
true
|
||||
|
Loading…
Reference in New Issue
Block a user