Add underline and bold only codes

This commit is contained in:
Heinz N. Gies 2015-09-22 17:08:46 +02:00
parent 9e66ca99c8
commit 8a756ea9c7
2 changed files with 12 additions and 0 deletions

View file

@ -13,6 +13,8 @@ syntax to add colours.
%% The colour can be one of:
%%
%% ! - resets the output
%% ^ - bold (no colour change)
%% __ - (two _) makes text underlined (no colour change)
%% x,X - black
%% r,R - red
%% g,G - greeen

View file

@ -28,6 +28,7 @@
%% The colour can be one of:
%%
%% ! - resets the output
%% ^ - makes text bold
%% x,X - black
%% r,R - red
%% g,G - greeen
@ -77,6 +78,7 @@ format(Fmt) ->
-define(BC, "\033[1;36m").
-define(BW, "\033[1;37m").
-define(U, "\033[4m").
-define(B, "\033[1m").
-define(BGX, "\033[40m").
-define(BGR, "\033[41m").
-define(BGG, "\033[42m").
@ -103,9 +105,17 @@ cfmt(S, Enabled) ->
cfmt_([$~,$!, _C | S], false) ->
cfmt_(S, false);
cfmt_([$~,$!, $_, _C | S], false) ->
cfmt_(S, false);
cfmt_([$~,$#, _C | S], false) ->
cfmt_(S, false);
cfmt_([$~, $!, $_, $_ | S], Enabled) ->
[?U | cfmt_(S, Enabled)];
cfmt_([$~,$!, $^ | S], Enabled) ->
[?B | cfmt_(S, Enabled)];
cfmt_([$~,$!, $_, $^ | S], Enabled) ->
[?U, ?B | cfmt_(S, Enabled)];
?CFMT($!, ?R);
?CFMT($x, ?NX);
?CFMT($X, ?BX);