aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeinz N. Gies <[email protected]>2016-02-16 11:58:04 -0500
committerHeinz N. Gies <[email protected]>2016-02-16 11:58:04 -0500
commit3ceb5594b249fba3e3cd26f6e76fd168f953c5c2 (patch)
tree86285643beb9aec08b4724b14c7496eff1354e98
parent10e29bcb37f53c3dc4a0949660b8b0b1ed37cf1b (diff)
downloadrelx-3ceb5594b249fba3e3cd26f6e76fd168f953c5c2.tar.gz
relx-3ceb5594b249fba3e3cd26f6e76fd168f953c5c2.tar.bz2
relx-3ceb5594b249fba3e3cd26f6e76fd168f953c5c2.zip
Use an app_env to get color intensity
-rw-r--r--src/rlx_util.erl24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/rlx_util.erl b/src/rlx_util.erl
index c1f7b38..7920379 100644
--- a/src/rlx_util.erl
+++ b/src/rlx_util.erl
@@ -299,15 +299,25 @@ cp_r_win32(Source,Dest) ->
end, filelib:wildcard(Source)),
ok.
+%% @doc Returns the color intensity, we first check the application envorinment
+%% if that is not set we check the environment variable RELX_COLOR.
intensity() ->
- case os:getenv("RELX_COLOR") of
- "high" ->
- high;
- "low" ->
- low;
- _ ->
- ?DFLT_INTENSITY
+ case application:get_env(relx, color_intensity) of
+ undefined ->
+ R = case os:getenv("RELX_COLOR") of
+ "high" ->
+ high;
+ "low" ->
+ low;
+ _ ->
+ ?DFLT_INTENSITY
+ end,
+ application:set_env(relx, color_intensity, R),
+ R;
+ Mode ->
+ Mode
end.
+
%%%===================================================================
%%% Test Functions
%%%===================================================================