Skip to content

Commit

Permalink
colored-man-pages: Update colors to use omb colors
Browse files Browse the repository at this point in the history
  • Loading branch information
RobLoach authored Oct 1, 2024
1 parent 0f04de0 commit db3ae23
Showing 1 changed file with 17 additions and 40 deletions.
57 changes: 17 additions & 40 deletions plugins/colored-man-pages/colored-man-pages.plugin.sh
Original file line number Diff line number Diff line change
@@ -1,47 +1,24 @@
#! bash oh-my-bash.module

# Safety get the colors.
if tput setaf 1 &> /dev/null; then
COLORED_MAN_PAGES_BLACK=$(tput setaf 0)
COLORED_MAN_PAGES_RED=$(tput setaf 1)
COLORED_MAN_PAGES_GREEN=$(tput setaf 2)
COLORED_MAN_PAGES_YELLOW=$(tput setaf 3)
COLORED_MAN_PAGES_BLUE=$(tput setaf 4)
COLORED_MAN_PAGES_MAGENTA=$(tput setaf 5)
COLORED_MAN_PAGES_CYAN=$(tput setaf 6)
COLORED_MAN_PAGES_WHITE=$(tput setaf 7)
COLORED_MAN_PAGES_BOLD=$(tput bold)
COLORED_MAN_PAGES_RESET=$(tput sgr0)

# Extra Styles
export LESS_TERMCAP_mr=$(tput rev) # Reverse
export LESS_TERMCAP_mh=$(tput dim) # Half Bright
export LESS_TERMCAP_ZN=$(tput ssubm) # Subscript
export LESS_TERMCAP_ZV=$(tput rsubm) # Reverse Superscript
export LESS_TERMCAP_ZO=$(tput ssupm) # Subscript
export LESS_TERMCAP_ZW=$(tput rsupm) # Reverse Superscript
else
COLORED_MAN_PAGES_BLACK="\033[1;30m"
COLORED_MAN_PAGES_RED="\033[1;31m"
COLORED_MAN_PAGES_GREEN="\033[1;32m"
COLORED_MAN_PAGES_YELLOW="\033[1;33m"
COLORED_MAN_PAGES_BLUE="\033[1;34m"
COLORED_MAN_PAGES_MAGENTA="\033[1;35m"
COLORED_MAN_PAGES_CYAN="\033[1;36m"
COLORED_MAN_PAGES_WHITE="\033[1;37m"
COLORED_MAN_PAGES_BOLD=""
COLORED_MAN_PAGES_RESET="\033[m"
fi

# Bold and Blinking
export LESS_TERMCAP_mb=$COLORED_MAN_PAGES_GREEN
export LESS_TERMCAP_md=$COLORED_MAN_PAGES_BOLD$COLORED_MAN_PAGES_GREEN
export LESS_TERMCAP_me=$COLORED_MAN_PAGES_RESET
export LESS_TERMCAP_mb=$_omb_term_green
export LESS_TERMCAP_md=$_omb_term_bold$_omb_term_green
export LESS_TERMCAP_me=$_omb_term_reset

# Standout Mode
export LESS_TERMCAP_so=$COLORED_MAN_PAGES_YELLOW
export LESS_TERMCAP_se=$COLORED_MAN_PAGES_RESET
export LESS_TERMCAP_so=$_omb_term_olive
export LESS_TERMCAP_se=$_omb_term_reset

# Underline
export LESS_TERMCAP_us=$COLORED_MAN_PAGES_MAGENTA
export LESS_TERMCAP_ue=$COLORED_MAN_PAGES_RESET
export LESS_TERMCAP_us=$_omb_term_purple
export LESS_TERMCAP_ue=$_omb_term_reset

# Extra Styles
if _omb_util_binary_exists tput; then
export LESS_TERMCAP_mr=$(tput rev 2>/dev/null || tput mr 2>/dev/null)
export LESS_TERMCAP_mh=$(tput dim 2>/dev/null || tput mh 2>/dev/null)
export LESS_TERMCAP_ZN=$(tput ssubm 2>/dev/null)
export LESS_TERMCAP_ZV=$(tput rsubm 2>/dev/null)
export LESS_TERMCAP_ZO=$(tput ssupm 2>/dev/null)
export LESS_TERMCAP_ZW=$(tput rsupm 2>/dev/null)
fi

0 comments on commit db3ae23

Please sign in to comment.