-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use set_color instead of hardcoded ansi (#8)
- Loading branch information
1 parent
4d17665
commit f885c25
Showing
1 changed file
with
7 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |