Skip to content

Commit

Permalink
Use set_color instead of hardcoded ansi (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlanCosman authored Apr 29, 2022
1 parent 4d17665 commit f885c25
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions functions/cless.fish
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
# colors documentation can be found at
# http://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html#256-colors
function cless -d "Configure less to colorize styled text using environment variables before executing a command that will use less"
set -l bold_ansi_code "\u001b[1m"
set -l underline_ansi_code "\u001b[4m"
set -l reversed_ansi_code "\u001b[7m"
set -l reset_ansi_code "\u001b[0m"
set -l teal_ansi_code "\u001b[38;5;31m"
set -l green_ansi_code "\u001b[38;5;70m"
set -l gold_ansi_code "\u001b[38;5;220m"

set -x LESS_TERMCAP_md (printf $bold_ansi_code$teal_ansi_code) # start bold
set -x LESS_TERMCAP_me (printf $reset_ansi_code) # end bold
set -x LESS_TERMCAP_us (printf $underline_ansi_code$green_ansi_code) # start underline
set -x LESS_TERMCAP_ue (printf $reset_ansi_code) # end underline
set -x LESS_TERMCAP_so (printf $reversed_ansi_code$gold_ansi_code) # start standout
set -x LESS_TERMCAP_se (printf $reset_ansi_code) # end standout
set -x LESS_TERMCAP_md (set_color --bold 0280A5) # start bold
set -x LESS_TERMCAP_me (set_color normal) # end bold
set -x LESS_TERMCAP_us (set_color --underline 5BA502) # start underline
set -x LESS_TERMCAP_ue (set_color normal) # end underline
set -x LESS_TERMCAP_so (set_color --reverse F0CB02) # start standout
set -x LESS_TERMCAP_se (set_color normal) # end standout

$argv
end
end

0 comments on commit f885c25

Please sign in to comment.