From 3ceb5594b249fba3e3cd26f6e76fd168f953c5c2 Mon Sep 17 00:00:00 2001 From: "Heinz N. Gies" Date: Tue, 16 Feb 2016 11:58:04 -0500 Subject: Use an app_env to get color intensity --- src/rlx_util.erl | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/rlx_util.erl') 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 %%%=================================================================== -- cgit v1.2.3