Compare commits

..

No commits in common. "master" and "0.2.2" have entirely different histories.

4 changed files with 5 additions and 48 deletions

View file

@ -1,8 +1,5 @@
TERMCAP_FILE=http://code.metager.de/source/raw/OpenBSD/src/share/termtypes/termtypes.master
all: src/termcap.erl
rebar3 compile
src/termcap.erl: termtypes.master.clean mk-termcap.escript termcap.erl
./mk-termcap.escript termtypes.master.clean > src/cf_term.erl
@ -13,10 +10,7 @@ termcap.erl:
clean:
[ -f termtypes.master ] && rm termtypes.master || true
[ -f termtypes.master.clean ] && rm termtypes.master.clean || true
compile:
rebar3 compile
termtypes.master.clean: termtypes.master
cat termtypes.master | grep -v '^#' | grep -v '^\s*$$' > termtypes.master.clean

View file

@ -1,8 +1,2 @@
{erl_opts, [debug_info]}.
{deps, []}.
{profiles, [
{shell, [
{deps, [sync]}
]}
]}.

View file

@ -1,6 +1,6 @@
{application,cf,
[{description,"Terminal colour helper"},
{vsn, git},
{vsn,"0.2.2"},
{registered,[]},
{applications,[kernel,stdlib]},
{env,[]},

View file

@ -38,11 +38,6 @@
%% c,C - cyan
%% w,W - white
%%
%% true color is supported by using
%% ~!#<rr><gg><bb> as each as hex values so ~!#ff6402
%%
%% the same can be done for the background by yusign ~##
%%
%% The function will disable colours on non x term termials
%% @end
print(Fmt, Args) ->
@ -118,37 +113,12 @@ cfmt(S) ->
cfmt(S, Enabled) ->
lists:flatten(cfmt_(S, Enabled)).
cfmt_([$~, $!, $#, _R1, _R2, _G1, _G2, _B1, _B2 | S], false) ->
cfmt_([$~,$!, $_, _C | S], false) ->
cfmt_(S, false);
cfmt_([$~, $#, $#, _R1, _R2, _G1, _G2, _B1, _B2 | S], false) ->
cfmt_([$~,$#, _C | S], false) ->
cfmt_(S, false);
cfmt_([$~, $!, $_, _C | S], false) ->
cfmt_([$~,$!, _C | S], false) ->
cfmt_(S, false);
cfmt_([$~, $#, _C | S], false) ->
cfmt_(S, false);
cfmt_([$~, $!, _C | S], false) ->
cfmt_(S, false);
cfmt_([$~, $!, $#, R1, R2, G1, G2, B1, B2 | S], Enabled) ->
R = list_to_integer([R1, R2], 16),
G = list_to_integer([G1, G2], 16),
B = list_to_integer([B1, B2], 16),
["\033[38;2;",
integer_to_list(R), $;,
integer_to_list(G), $;,
integer_to_list(B), $m |
cfmt_(S, Enabled)];
cfmt_([$~, $#, $#, R1, R2, G1, G2, B1, B2 | S], Enabled) ->
R = list_to_integer([R1, R2], 16),
G = list_to_integer([G1, G2], 16),
B = list_to_integer([B1, B2], 16),
["\033[48;2;",
integer_to_list(R), $;,
integer_to_list(G), $;,
integer_to_list(B), $m |
cfmt_(S, Enabled)];
cfmt_([$~, $!, $_, $_ | S], Enabled) ->
[?U |cfmt_(S, Enabled)];
@ -156,7 +126,6 @@ cfmt_([$~,$!, $^ | S], Enabled) ->
[?B | cfmt_(S, Enabled)];
cfmt_([$~,$!, $_, $^ | S], Enabled) ->
[?U, ?B | cfmt_(S, Enabled)];
?CFMT($!, ?R);
?CFMT($x, ?NX);
?CFMT($X, ?BX);