repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

bash/bashrc

Raw
# Bash interactive config from dotfiles.

case "$-" in
	*i*) ;;
	*) return ;;
esac

# Linux virtual console colors. No sudo, no effect in terminal emulators.
_nugu_console_theme() {
	[ "${TERM:-}" = linux ] || return 0

	local mode="${1:-light}"
	local theme="$HOME/.config/bash/linux-console/nugu-$mode.sh"

	if [ ! -r "$theme" ]; then
		printf 'missing theme: %s\n' "$theme" >&2
		return 1
	fi

	. "$theme"
	clear
}

tt() {
	case "${1:-toggle}" in
		dark|light) _nugu_console_theme "$1" ;;
		toggle)
			case "${NUGU_CONSOLE_THEME:-light}" in
				light) _nugu_console_theme dark ;;
				dark) _nugu_console_theme light ;;
				*) _nugu_console_theme light ;;
			esac
			;;
		*)
			printf 'usage: tt [dark|light]\n' >&2
			return 2
			;;
	esac
}

_nugu_console_theme light