├── rebar.lock ├── rebar.config ├── .gitignore ├── src ├── cf.app.src ├── cf.erl └── cf_term.erl ├── Makefile ├── README.md ├── LICENSE └── mk-termcap.escript /rebar.lock: -------------------------------------------------------------------------------- 1 | []. 2 | -------------------------------------------------------------------------------- /rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. 3 | 4 | {profiles, [ 5 | {shell, [ 6 | {deps, [sync]} 7 | ]} 8 | ]}. 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .rebar3 2 | _* 3 | .eunit 4 | *.o 5 | *.beam 6 | *.plt 7 | *.swp 8 | *.swo 9 | .erlang.cookie 10 | ebin 11 | log 12 | erl_crash.dump 13 | .rebar 14 | _rel 15 | _deps 16 | _plugins 17 | _tdeps 18 | logs 19 | _build 20 | termtypes.master 21 | termtypes.master.clean 22 | -------------------------------------------------------------------------------- /src/cf.app.src: -------------------------------------------------------------------------------- 1 | {application,cf, 2 | [{description,"Terminal colour helper"}, 3 | {vsn, git}, 4 | {registered,[]}, 5 | {applications,[kernel,stdlib]}, 6 | {env,[]}, 7 | {modules,[]}, 8 | {maintainers,["Heinz N. Gies "]}, 9 | {licenses,["MIT"]}, 10 | {links,[{"github","https://github.com/project-fifo/cf"}]}]}. 11 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TERMCAP_FILE=http://code.metager.de/source/raw/OpenBSD/src/share/termtypes/termtypes.master 2 | 3 | all: src/termcap.erl 4 | rebar3 compile 5 | 6 | src/termcap.erl: termtypes.master.clean mk-termcap.escript termcap.erl 7 | ./mk-termcap.escript termtypes.master.clean > src/cf_term.erl 8 | 9 | mk-termcap.escript: 10 | 11 | termcap.erl: 12 | 13 | clean: 14 | [ -f termtypes.master ] && rm termtypes.master || true 15 | [ -f termtypes.master.clean ] && rm termtypes.master.clean || true 16 | 17 | compile: 18 | rebar3 compile 19 | 20 | termtypes.master.clean: termtypes.master 21 | cat termtypes.master | grep -v '^#' | grep -v '^\s*$$' > termtypes.master.clean 22 | 23 | termtypes.master: 24 | curl -O $(TERMCAP_FILE) 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | cf 2 | ===== 3 | 4 | A helper library for termial colour printing extending the io:format 5 | syntax to add colours. 6 | 7 | ```erlang 8 | %% Effectively the same as io:format just takes the additional color 9 | %% console text colour can be set by ~!****. ~#**** 10 | %% will change the background. Both ~# only work with lowercase colours. 11 | %% An uppercase letersindicate bold colours. 12 | %% 13 | %% The colour can be one of: 14 | %% 15 | %% ! - resets the output 16 | %% ^ - bold (no colour change) 17 | %% __ - (two _) makes text underlined (no colour change) 18 | %% x,X - black 19 | %% r,R - red 20 | %% g,G - greeen 21 | %% y,Y - yellow 22 | %% b,B - blue 23 | %% m,M - magenta 24 | %% c,C - cyan 25 | %% w,W - white 26 | %% 27 | %% The function will disable colours on non x term termials 28 | ``` 29 | 30 | Build 31 | ----- 32 | 33 | $ rebar3 compile 34 | 35 | 36 | Usage 37 | ----- 38 | 39 | `cf:format/[1,2]` - an equivalent to `io_lib:format/[1,2]`. 40 | `cf:print/[1,2]` - an equivalent to `io:format/[1,2]`. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Project-FiFo UG 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | * The names of its contributors may not be used to endorse or promote 16 | products derived from this software without specific prior written 17 | permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /mk-termcap.escript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env escript 2 | main([In]) -> 3 | {ok, File} = file:open(In, [read]), 4 | case io:get_line(File, "") of 5 | eof -> 6 | file:close(File); 7 | Cap -> 8 | io:format("-module(cf_term).~n"), 9 | io:format("-export([has_color/1]).~n"), 10 | Terms = read_lines(File, {parse_name(Cap), ""}, []), 11 | Terms1 = [{T, has_color(Vs, Terms)} || {T, Vs} <- Terms], 12 | [io:format("has_color(~p) -> true;~n", [T]) || {T, true} <- Terms1], 13 | io:format("has_color(_) -> false.~n") 14 | end. 15 | 16 | read_lines(File, {H, Acc}, FAcc) -> 17 | case io:get_line(File, "") of 18 | eof -> 19 | file:close(File), 20 | lists:sort([{H, parse_caps(Acc)} | FAcc]); 21 | " " ++ Rest -> 22 | case Acc of 23 | "" -> 24 | read_lines(File, {H, remove_newline(strip_ws(Rest))}, FAcc); 25 | _ -> 26 | read_lines(File, {H, [Acc, " ", remove_newline(strip_ws(Rest))]}, FAcc) 27 | end; 28 | "\t" ++ Rest -> 29 | case Acc of 30 | "" -> 31 | read_lines(File, {H, remove_newline(strip_ws(Rest))}, FAcc); 32 | _ -> 33 | read_lines(File, {H, [Acc, " ", remove_newline(strip_ws(Rest))]}, FAcc) 34 | end; 35 | Cap -> 36 | read_lines(File, {parse_name(Cap), ""}, [{H, parse_caps(Acc)} | FAcc]) 37 | end. 38 | 39 | has_color([], _Ts) -> 40 | false; 41 | has_color([{colors, _} | _], _Ts) -> 42 | true; 43 | has_color([{use, T} | R], Ts) -> 44 | case orddict:find(T, Ts) of 45 | error -> 46 | has_color(R, Ts); 47 | {ok, V} -> 48 | has_color(V, Ts) orelse 49 | has_color(R, Ts) 50 | end. 51 | 52 | remove_newline(S) -> 53 | remove_newline(S, []). 54 | 55 | remove_newline("\n", Acc) -> 56 | lists:reverse(Acc); 57 | 58 | remove_newline("", Acc) -> 59 | lists:reverse(Acc); 60 | remove_newline([C | R], Acc) -> 61 | remove_newline(R, [C | Acc]). 62 | 63 | strip_ws([$\s | R]) -> 64 | strip_ws(R); 65 | strip_ws([$\t | R]) -> 66 | strip_ws(R); 67 | strip_ws(R) -> 68 | R. 69 | 70 | filter_caps([]) -> 71 | []; 72 | filter_caps([{colors, _} = C | R]) -> 73 | [C | filter_caps(R)]; 74 | filter_caps([{use, _} = C | R]) -> 75 | [C | filter_caps(R)]; 76 | filter_caps([_ | R]) -> 77 | filter_caps(R). 78 | 79 | 80 | remove_colon(S) -> 81 | re:replace(S, ",[\\s\\n\\t]*$", "", [{return,list}]). 82 | 83 | parse_name(S) -> 84 | [Term | _Rest] = re:split(remove_colon(S), "\\|", [{return,list}]), 85 | Term. 86 | 87 | parse_caps(S) -> 88 | Caps = re:split(remove_colon(S), ",[\\s\\t]+", [{return,list}]), 89 | filter_caps([parse_cap(C, []) || C <- Caps, C =/= ""]). 90 | 91 | parse_cap([], Name) -> 92 | list_to_atom(lists:reverse(Name)); 93 | parse_cap([$= | V], Name) -> 94 | {list_to_atom(lists:reverse(Name)), V}; 95 | parse_cap([$# | V], Name) -> 96 | {list_to_atom(lists:reverse(Name)), list_to_integer(V)}; 97 | parse_cap([C | R], Name) -> 98 | parse_cap(R, [ C | Name]). 99 | 100 | -------------------------------------------------------------------------------- /src/cf.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %%% @author Heinz Nikolaus Gies 3 | %%% @copyright (C) 2015, Project-FiFo UG 4 | %%% @doc 5 | %%% Printing library for coloured console output, extends the format 6 | %%% strings by adding ~! (forground) ~# (background) and ~_ (underline) 7 | %%% terminal colours. 8 | %%% @end 9 | %%% Created : 22 Sep 2015 by Heinz Nikolaus Gies 10 | %%%------------------------------------------------------------------- 11 | -module(cf). 12 | 13 | 14 | %% API exports 15 | -export([format/1, format/2]). 16 | -export([print/1, print/2]). 17 | 18 | %%==================================================================== 19 | %% API functions 20 | %%==================================================================== 21 | %% @doc Prints a coloured string. 22 | %% Effectively the same as io:format just takes the additional color 23 | %% console text colour can be set by ~!****. ~#**** 24 | %% will change the background. Both ~# only work with lowercase colours. 25 | %% An uppercase letersindicate bold colours. 26 | %% A `_` can be added after the ~! to make the text underlined. 27 | %% 28 | %% The colour can be one of: 29 | %% 30 | %% ! - resets the output 31 | %% ^ - makes text bold 32 | %% x,X - black 33 | %% r,R - red 34 | %% g,G - greeen 35 | %% y,Y - yellow 36 | %% b,B - blue 37 | %% m,M - magenta 38 | %% c,C - cyan 39 | %% w,W - white 40 | %% 41 | %% true color is supported by using 42 | %% ~!# as each as hex values so ~!#ff6402 43 | %% 44 | %% the same can be done for the background by yusign ~## 45 | %% 46 | %% The function will disable colours on non x term termials 47 | %% @end 48 | print(Fmt, Args) -> 49 | io:format(cfmt(Fmt), Args). 50 | 51 | %% @doc Formates a coloured string 52 | %% Arguments are the same as for print/2, just returns a string as 53 | %% io_lib:format/2 does instead of printing it to stdout. 54 | %% @end 55 | format(Fmt, Args) -> 56 | io_lib:format(cfmt(Fmt), Args). 57 | 58 | 59 | print(Fmt) -> 60 | print(Fmt, []). 61 | format(Fmt) -> 62 | format(Fmt, []). 63 | 64 | %%==================================================================== 65 | %% Internal functions 66 | %%==================================================================== 67 | 68 | 69 | -define(NX, "\033[0;30m"). 70 | -define(NR, "\033[0;31m"). 71 | -define(NG, "\033[0;32m"). 72 | -define(NY, "\033[0;33m"). 73 | -define(NB, "\033[0;34m"). 74 | -define(NM, "\033[0;35m"). 75 | -define(NC, "\033[0;36m"). 76 | -define(NW, "\033[0;37m"). 77 | -define(BX, "\033[1;30m"). 78 | -define(BR, "\033[1;31m"). 79 | -define(BG, "\033[1;32m"). 80 | -define(BY, "\033[1;33m"). 81 | -define(BB, "\033[1;34m"). 82 | -define(BM, "\033[1;35m"). 83 | -define(BC, "\033[1;36m"). 84 | -define(BW, "\033[1;37m"). 85 | -define(U, "\033[4m"). 86 | -define(B, "\033[1m"). 87 | -define(BGX, "\033[40m"). 88 | -define(BGR, "\033[41m"). 89 | -define(BGG, "\033[42m"). 90 | -define(BGY, "\033[43m"). 91 | -define(BGB, "\033[44m"). 92 | -define(BGM, "\033[45m"). 93 | -define(BGC, "\033[46m"). 94 | -define(BGW, "\033[47m"). 95 | -define(R, "\033[0m"). 96 | -define(CFMT(Char, Colour), 97 | cfmt_([$~, $!, Char | S], Enabled) -> [Colour | cfmt_(S, Enabled)]; 98 | cfmt_([$~, $!, $_, Char | S], Enabled) -> [Colour, ?U | cfmt_(S, Enabled)]). 99 | -define(CFMT_BG(Char, Colour), 100 | cfmt_([$~, $#, Char | S], Enabled) -> [Colour | cfmt_(S, Enabled)]). 101 | -define(CFMT_U(Char, Colour), 102 | cfmt_([$~, $_, Char | S], Enabled) -> [Colour | cfmt_(S, Enabled)]). 103 | 104 | colour_term() -> 105 | case application:get_env(cf, colour_term) of 106 | {ok, V} -> 107 | V; 108 | undefined -> 109 | Term = os:getenv("TERM"), 110 | V = cf_term:has_color(Term), 111 | application:set_env(cf, colour_term, V), 112 | V 113 | end. 114 | 115 | cfmt(S) -> 116 | cfmt(S, colour_term()). 117 | 118 | cfmt(S, Enabled) -> 119 | lists:flatten(cfmt_(S, Enabled)). 120 | 121 | cfmt_([$~, $!, $#, _R1, _R2, _G1, _G2, _B1, _B2 | S], false) -> 122 | cfmt_(S, false); 123 | cfmt_([$~, $#, $#, _R1, _R2, _G1, _G2, _B1, _B2 | S], false) -> 124 | cfmt_(S, false); 125 | 126 | cfmt_([$~, $!, $_, _C | S], false) -> 127 | cfmt_(S, false); 128 | cfmt_([$~, $#, _C | S], false) -> 129 | cfmt_(S, false); 130 | cfmt_([$~, $!, _C | S], false) -> 131 | cfmt_(S, false); 132 | 133 | cfmt_([$~, $!, $#, R1, R2, G1, G2, B1, B2 | S], Enabled) -> 134 | R = list_to_integer([R1, R2], 16), 135 | G = list_to_integer([G1, G2], 16), 136 | B = list_to_integer([B1, B2], 16), 137 | ["\033[38;2;", 138 | integer_to_list(R), $;, 139 | integer_to_list(G), $;, 140 | integer_to_list(B), $m | 141 | cfmt_(S, Enabled)]; 142 | 143 | cfmt_([$~, $#, $#, R1, R2, G1, G2, B1, B2 | S], Enabled) -> 144 | R = list_to_integer([R1, R2], 16), 145 | G = list_to_integer([G1, G2], 16), 146 | B = list_to_integer([B1, B2], 16), 147 | ["\033[48;2;", 148 | integer_to_list(R), $;, 149 | integer_to_list(G), $;, 150 | integer_to_list(B), $m | 151 | cfmt_(S, Enabled)]; 152 | 153 | cfmt_([$~, $!, $_, $_ | S], Enabled) -> 154 | [?U |cfmt_(S, Enabled)]; 155 | cfmt_([$~,$!, $^ | S], Enabled) -> 156 | [?B | cfmt_(S, Enabled)]; 157 | cfmt_([$~,$!, $_, $^ | S], Enabled) -> 158 | [?U, ?B | cfmt_(S, Enabled)]; 159 | 160 | ?CFMT($!, ?R); 161 | ?CFMT($x, ?NX); 162 | ?CFMT($X, ?BX); 163 | ?CFMT($r, ?NR); 164 | ?CFMT($R, ?BR); 165 | ?CFMT($g, ?NG); 166 | ?CFMT($G, ?BG); 167 | ?CFMT($y, ?NY); 168 | ?CFMT($Y, ?BY); 169 | ?CFMT($b, ?NB); 170 | ?CFMT($B, ?BB); 171 | ?CFMT($m, ?NM); 172 | ?CFMT($M, ?BM); 173 | ?CFMT($c, ?NC); 174 | ?CFMT($C, ?BC); 175 | ?CFMT($w, ?NW); 176 | ?CFMT($W, ?BW); 177 | 178 | ?CFMT_BG($x, ?BGX); 179 | ?CFMT_BG($r, ?BGR); 180 | ?CFMT_BG($g, ?BGG); 181 | ?CFMT_BG($y, ?BGY); 182 | ?CFMT_BG($b, ?BGB); 183 | ?CFMT_BG($m, ?BGM); 184 | ?CFMT_BG($c, ?BGC); 185 | ?CFMT_BG($w, ?BGW); 186 | 187 | cfmt_([$~,$~ | S], Enabled) -> 188 | [$~,$~ | cfmt_(S, Enabled)]; 189 | 190 | cfmt_([C | S], Enabled) -> 191 | [C | cfmt_(S, Enabled)]; 192 | 193 | cfmt_([], false) -> 194 | ""; 195 | cfmt_([], _Enabled) -> 196 | ?R. 197 | -------------------------------------------------------------------------------- /src/cf_term.erl: -------------------------------------------------------------------------------- 1 | -module(cf_term). 2 | -export([has_color/1]). 3 | has_color("Eterm") -> true; 4 | has_color("Eterm-256color") -> true; 5 | has_color("Eterm-88color") -> true; 6 | has_color("aixterm") -> true; 7 | has_color("aixterm-16color") -> true; 8 | has_color("amiga-vnc") -> true; 9 | has_color("ansi") -> true; 10 | has_color("ansi-color-2-emx") -> true; 11 | has_color("ansi-color-3-emx") -> true; 12 | has_color("ansi-emx") -> true; 13 | has_color("ansi.sys") -> true; 14 | has_color("ansi.sys-old") -> true; 15 | has_color("ansi.sysk") -> true; 16 | has_color("arm100") -> true; 17 | has_color("arm100-w") -> true; 18 | has_color("aterm") -> true; 19 | has_color("att6386") -> true; 20 | has_color("beterm") -> true; 21 | has_color("bsdos-pc") -> true; 22 | has_color("bsdos-pc-nobold") -> true; 23 | has_color("bsdos-ppc") -> true; 24 | has_color("bterm") -> true; 25 | has_color("color_xterm") -> true; 26 | has_color("cons25") -> true; 27 | has_color("cons25-debian") -> true; 28 | has_color("cons25-m") -> true; 29 | has_color("cons25l1") -> true; 30 | has_color("cons25l1-m") -> true; 31 | has_color("cons25r") -> true; 32 | has_color("cons25r-m") -> true; 33 | has_color("cons25w") -> true; 34 | has_color("cons30") -> true; 35 | has_color("cons30-m") -> true; 36 | has_color("cons43") -> true; 37 | has_color("cons43-m") -> true; 38 | has_color("cons50") -> true; 39 | has_color("cons50-m") -> true; 40 | has_color("cons50l1") -> true; 41 | has_color("cons50l1-m") -> true; 42 | has_color("cons50r") -> true; 43 | has_color("cons50r-m") -> true; 44 | has_color("cons60") -> true; 45 | has_color("cons60-m") -> true; 46 | has_color("cons60l1") -> true; 47 | has_color("cons60l1-m") -> true; 48 | has_color("cons60r") -> true; 49 | has_color("cons60r-m") -> true; 50 | has_color("crt") -> true; 51 | has_color("ctrm") -> true; 52 | has_color("cygwin") -> true; 53 | has_color("cygwinB19") -> true; 54 | has_color("cygwinDBG") -> true; 55 | has_color("d220") -> true; 56 | has_color("d220-7b") -> true; 57 | has_color("d220-dg") -> true; 58 | has_color("d230c") -> true; 59 | has_color("d230c-dg") -> true; 60 | has_color("d430c-dg") -> true; 61 | has_color("d430c-dg-ccc") -> true; 62 | has_color("d430c-unix") -> true; 63 | has_color("d430c-unix-25") -> true; 64 | has_color("d430c-unix-25-ccc") -> true; 65 | has_color("d430c-unix-ccc") -> true; 66 | has_color("d430c-unix-s") -> true; 67 | has_color("d430c-unix-s-ccc") -> true; 68 | has_color("d430c-unix-sr") -> true; 69 | has_color("d430c-unix-sr-ccc") -> true; 70 | has_color("d430c-unix-w") -> true; 71 | has_color("d430c-unix-w-ccc") -> true; 72 | has_color("d470c") -> true; 73 | has_color("d470c-7b") -> true; 74 | has_color("d470c-dg") -> true; 75 | has_color("decansi") -> true; 76 | has_color("dg+ccc") -> true; 77 | has_color("dg+color") -> true; 78 | has_color("dg+color8") -> true; 79 | has_color("dg+fixed") -> true; 80 | has_color("dgmode+color") -> true; 81 | has_color("dgmode+color8") -> true; 82 | has_color("dgunix+ccc") -> true; 83 | has_color("dgunix+fixed") -> true; 84 | has_color("djgpp") -> true; 85 | has_color("djgpp204") -> true; 86 | has_color("dtterm") -> true; 87 | has_color("ecma+color") -> true; 88 | has_color("emu") -> true; 89 | has_color("emx-base") -> true; 90 | has_color("eterm-color") -> true; 91 | has_color("gnome") -> true; 92 | has_color("gnome-2007") -> true; 93 | has_color("gnome-2008") -> true; 94 | has_color("gnome-2012") -> true; 95 | has_color("gnome-256color") -> true; 96 | has_color("gnome-fc5") -> true; 97 | has_color("gnome-rh62") -> true; 98 | has_color("gnome-rh72") -> true; 99 | has_color("gnome-rh80") -> true; 100 | has_color("gnome-rh90") -> true; 101 | has_color("gs6300") -> true; 102 | has_color("hft-c") -> true; 103 | has_color("hft-c-old") -> true; 104 | has_color("hft-old") -> true; 105 | has_color("hp+color") -> true; 106 | has_color("hp2397a") -> true; 107 | has_color("hpterm-color") -> true; 108 | has_color("hurd") -> true; 109 | has_color("iTerm.app") -> true; 110 | has_color("ibm+16color") -> true; 111 | has_color("ibm+color") -> true; 112 | has_color("ibm3164") -> true; 113 | has_color("ibm5081") -> true; 114 | has_color("ibm5154") -> true; 115 | has_color("ibm6154") -> true; 116 | has_color("ibm8503") -> true; 117 | has_color("ibm8512") -> true; 118 | has_color("ibmpc3") -> true; 119 | has_color("interix") -> true; 120 | has_color("iris-color") -> true; 121 | has_color("jaixterm") -> true; 122 | has_color("klone+color") -> true; 123 | has_color("kon") -> true; 124 | has_color("konsole") -> true; 125 | has_color("konsole-16color") -> true; 126 | has_color("konsole-256color") -> true; 127 | has_color("konsole-base") -> true; 128 | has_color("konsole-linux") -> true; 129 | has_color("konsole-solaris") -> true; 130 | has_color("konsole-vt100") -> true; 131 | has_color("konsole-vt420pc") -> true; 132 | has_color("konsole-xf3x") -> true; 133 | has_color("konsole-xf4x") -> true; 134 | has_color("kterm") -> true; 135 | has_color("kterm-color") -> true; 136 | has_color("kvt") -> true; 137 | has_color("linux") -> true; 138 | has_color("linux-16color") -> true; 139 | has_color("linux-basic") -> true; 140 | has_color("linux-c") -> true; 141 | has_color("linux-c-nc") -> true; 142 | has_color("linux-koi8") -> true; 143 | has_color("linux-koi8r") -> true; 144 | has_color("linux-lat") -> true; 145 | has_color("linux-m") -> true; 146 | has_color("linux-nic") -> true; 147 | has_color("linux-vt") -> true; 148 | has_color("linux2.2") -> true; 149 | has_color("linux2.6") -> true; 150 | has_color("linux2.6.26") -> true; 151 | has_color("linux3.0") -> true; 152 | has_color("mach-color") -> true; 153 | has_color("mach-gnu-color") -> true; 154 | has_color("mgt") -> true; 155 | has_color("mgterm") -> true; 156 | has_color("minitel1") -> true; 157 | has_color("minitel1b") -> true; 158 | has_color("minitel1b-80") -> true; 159 | has_color("minix") -> true; 160 | has_color("minix-3.0") -> true; 161 | has_color("mlterm") -> true; 162 | has_color("mlterm-256color") -> true; 163 | has_color("mlterm2") -> true; 164 | has_color("mlterm3") -> true; 165 | has_color("mrxvt") -> true; 166 | has_color("mrxvt-256color") -> true; 167 | has_color("ms-vt-utf8") -> true; 168 | has_color("ms-vt100+") -> true; 169 | has_color("ms-vt100-color") -> true; 170 | has_color("mvterm") -> true; 171 | has_color("nansi.sys") -> true; 172 | has_color("nansi.sysk") -> true; 173 | has_color("ncr260intan") -> true; 174 | has_color("ncr260intpp") -> true; 175 | has_color("ncr260intwan") -> true; 176 | has_color("ncr260intwpp") -> true; 177 | has_color("ncr260wy325pp") -> true; 178 | has_color("ncr260wy325wpp") -> true; 179 | has_color("ncr260wy350pp") -> true; 180 | has_color("ncr260wy350wpp") -> true; 181 | has_color("ncsa") -> true; 182 | has_color("ncsa-ns") -> true; 183 | has_color("ncsa-vt220") -> true; 184 | has_color("netbsd6") -> true; 185 | has_color("nsterm") -> true; 186 | has_color("nsterm+c") -> true; 187 | has_color("nsterm+c41") -> true; 188 | has_color("nsterm-16color") -> true; 189 | has_color("nsterm-256color") -> true; 190 | has_color("nsterm-7") -> true; 191 | has_color("nsterm-7-c") -> true; 192 | has_color("nsterm-acs") -> true; 193 | has_color("nsterm-bce") -> true; 194 | has_color("nsterm-build326") -> true; 195 | has_color("nsterm-build343") -> true; 196 | has_color("nsterm-c") -> true; 197 | has_color("nsterm-c-acs") -> true; 198 | has_color("nsterm-c-s") -> true; 199 | has_color("nsterm-c-s-7") -> true; 200 | has_color("nsterm-c-s-acs") -> true; 201 | has_color("nsterm-old") -> true; 202 | has_color("nsterm-s") -> true; 203 | has_color("nsterm-s-7") -> true; 204 | has_color("nsterm-s-acs") -> true; 205 | has_color("pc-minix") -> true; 206 | has_color("pc3") -> true; 207 | has_color("pcansi") -> true; 208 | has_color("pcansi-25") -> true; 209 | has_color("pcansi-33") -> true; 210 | has_color("pcansi-43") -> true; 211 | has_color("pccon") -> true; 212 | has_color("pccon+colors") -> true; 213 | has_color("pccon0") -> true; 214 | has_color("pcvt25-color") -> true; 215 | has_color("putty") -> true; 216 | has_color("putty-256color") -> true; 217 | has_color("putty-sco") -> true; 218 | has_color("putty-vt100") -> true; 219 | has_color("qansi") -> true; 220 | has_color("qansi-g") -> true; 221 | has_color("qansi-m") -> true; 222 | has_color("qansi-t") -> true; 223 | has_color("qansi-w") -> true; 224 | has_color("qnx") -> true; 225 | has_color("rcons-color") -> true; 226 | has_color("rxvt") -> true; 227 | has_color("rxvt-16color") -> true; 228 | has_color("rxvt-256color") -> true; 229 | has_color("rxvt-88color") -> true; 230 | has_color("rxvt-color") -> true; 231 | has_color("rxvt-cygwin") -> true; 232 | has_color("rxvt-cygwin-native") -> true; 233 | has_color("rxvt-unicode") -> true; 234 | has_color("rxvt-unicode-256color") -> true; 235 | has_color("rxvt-xpm") -> true; 236 | has_color("scoansi") -> true; 237 | has_color("scoansi-new") -> true; 238 | has_color("scoansi-old") -> true; 239 | has_color("screen") -> true; 240 | has_color("screen-16color") -> true; 241 | has_color("screen-16color-bce") -> true; 242 | has_color("screen-16color-bce-s") -> true; 243 | has_color("screen-16color-s") -> true; 244 | has_color("screen-256color") -> true; 245 | has_color("screen-256color-bce") -> true; 246 | has_color("screen-256color-bce-s") -> true; 247 | has_color("screen-256color-s") -> true; 248 | has_color("screen-bce") -> true; 249 | has_color("screen-bce.Eterm") -> true; 250 | has_color("screen-bce.gnome") -> true; 251 | has_color("screen-bce.konsole") -> true; 252 | has_color("screen-bce.linux") -> true; 253 | has_color("screen-bce.mrxvt") -> true; 254 | has_color("screen-bce.rxvt") -> true; 255 | has_color("screen-s") -> true; 256 | has_color("screen-w") -> true; 257 | has_color("screen.Eterm") -> true; 258 | has_color("screen.gnome") -> true; 259 | has_color("screen.konsole") -> true; 260 | has_color("screen.konsole-256color") -> true; 261 | has_color("screen.linux") -> true; 262 | has_color("screen.mlterm") -> true; 263 | has_color("screen.mlterm-256color") -> true; 264 | has_color("screen.mrxvt") -> true; 265 | has_color("screen.putty") -> true; 266 | has_color("screen.putty-256color") -> true; 267 | has_color("screen.rxvt") -> true; 268 | has_color("screen.teraterm") -> true; 269 | has_color("screen.vte") -> true; 270 | has_color("screen.vte-256color") -> true; 271 | has_color("screen.xterm-256color") -> true; 272 | has_color("screen.xterm-xfree86") -> true; 273 | has_color("simpleterm") -> true; 274 | has_color("st") -> true; 275 | has_color("st-16color") -> true; 276 | has_color("st-256color") -> true; 277 | has_color("st52-color") -> true; 278 | has_color("sun-color") -> true; 279 | has_color("tek4205") -> true; 280 | has_color("teken") -> true; 281 | has_color("teraterm") -> true; 282 | has_color("teraterm2.3") -> true; 283 | has_color("teraterm4.59") -> true; 284 | has_color("terminator") -> true; 285 | has_color("terminology") -> true; 286 | has_color("ti928") -> true; 287 | has_color("ti928-8") -> true; 288 | has_color("ti_ansi") -> true; 289 | has_color("tmux") -> true; 290 | has_color("tmux-256color") -> true; 291 | has_color("tw100") -> true; 292 | has_color("tw52") -> true; 293 | has_color("uwin") -> true; 294 | has_color("vte") -> true; 295 | has_color("vte-2007") -> true; 296 | has_color("vte-2008") -> true; 297 | has_color("vte-2012") -> true; 298 | has_color("vte-2014") -> true; 299 | has_color("vte-256color") -> true; 300 | has_color("vwmterm") -> true; 301 | has_color("wsvt25") -> true; 302 | has_color("wsvt25m") -> true; 303 | has_color("wy350") -> true; 304 | has_color("wy350-vb") -> true; 305 | has_color("wy350-w") -> true; 306 | has_color("wy350-wvb") -> true; 307 | has_color("wy370") -> true; 308 | has_color("wy370-105k") -> true; 309 | has_color("wy370-EPC") -> true; 310 | has_color("wy370-nk") -> true; 311 | has_color("wy370-rv") -> true; 312 | has_color("wy370-vb") -> true; 313 | has_color("wy370-w") -> true; 314 | has_color("wy370-wvb") -> true; 315 | has_color("xfce") -> true; 316 | has_color("xiterm") -> true; 317 | has_color("xnuppc") -> true; 318 | has_color("xnuppc+c") -> true; 319 | has_color("xnuppc-100x37") -> true; 320 | has_color("xnuppc-112x37") -> true; 321 | has_color("xnuppc-128x40") -> true; 322 | has_color("xnuppc-128x48") -> true; 323 | has_color("xnuppc-144x48") -> true; 324 | has_color("xnuppc-160x64") -> true; 325 | has_color("xnuppc-200x64") -> true; 326 | has_color("xnuppc-200x75") -> true; 327 | has_color("xnuppc-256x96") -> true; 328 | has_color("xnuppc-80x25") -> true; 329 | has_color("xnuppc-80x30") -> true; 330 | has_color("xnuppc-90x30") -> true; 331 | has_color("xnuppc-b") -> true; 332 | has_color("xnuppc-f") -> true; 333 | has_color("xnuppc-f2") -> true; 334 | has_color("xterm") -> true; 335 | has_color("xterm+256color") -> true; 336 | has_color("xterm+256setaf") -> true; 337 | has_color("xterm+88color") -> true; 338 | has_color("xterm-1002") -> true; 339 | has_color("xterm-1003") -> true; 340 | has_color("xterm-1005") -> true; 341 | has_color("xterm-1006") -> true; 342 | has_color("xterm-16color") -> true; 343 | has_color("xterm-256color") -> true; 344 | has_color("xterm-88color") -> true; 345 | has_color("xterm-8bit") -> true; 346 | has_color("xterm-basic") -> true; 347 | has_color("xterm-color") -> true; 348 | has_color("xterm-hp") -> true; 349 | has_color("xterm-new") -> true; 350 | has_color("xterm-nic") -> true; 351 | has_color("xterm-noapp") -> true; 352 | has_color("xterm-sco") -> true; 353 | has_color("xterm-sun") -> true; 354 | has_color("xterm-utf8") -> true; 355 | has_color("xterm-vt220") -> true; 356 | has_color("xterm-x10mouse") -> true; 357 | has_color("xterm-x11hilite") -> true; 358 | has_color("xterm-x11mouse") -> true; 359 | has_color("xterm-xf86-v32") -> true; 360 | has_color("xterm-xf86-v33") -> true; 361 | has_color("xterm-xf86-v333") -> true; 362 | has_color("xterm-xf86-v40") -> true; 363 | has_color("xterm-xf86-v43") -> true; 364 | has_color("xterm-xf86-v44") -> true; 365 | has_color("xterm-xfree86") -> true; 366 | has_color("xterm-xi") -> true; 367 | has_color("xterm1") -> true; 368 | has_color("xtermc") -> true; 369 | has_color("xterms-sun") -> true; 370 | has_color(_) -> false. 371 | --------------------------------------------------------------------------------