Commit bfe77b62 authored by Bruno Pinto's avatar Bruno Pinto Committed by Jorge Bucaran

Handle scenarios where colors are not defined.

Fish should set default colors:
https://github.com/fish-shell/fish-shell/blob/b32f770a69527eca4e76b9e8f648a39da17911cb/share/functions/__fish_config_interactive.fish

But in case some users don't have these color variables set, use their
defaults values.
parent 20ed4398
......@@ -16,10 +16,30 @@ set -g OMF_UNKNOWN_ERR 4
set -g OMF_VERSION "1.0.0"
function omf::em; set_color -o $fish_color_match; end
function omf::dim; set_color -o $fish_color_autosuggestion; end
function omf::err; set_color -o $fish_color_error; end
function omf::off; set_color normal; end
function omf::em
if set -q fish_color_match
set_color $fish_color_match
else
set_color cyan
end
end
function omf::dim
if set -q fish_color_autosuggestion
set_color $fish_color_autosuggestion
else
set_color 555 yellow
end
end
function omf::err
if set -q fish_color_error
set_color $fish_color_error
else
set_color red --bold
end
end
function omf::off
set_color normal
end
function init -a path --on-event init_omf
autoload $path/cli $path/util
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment