C
C
cheremsha112019-05-29 12:11:47
PHP
cheremsha11, 2019-05-29 12:11:47

How to implement cross-console output coloring?

Implemented echo output with color highlighting (to the console). I tested it on different systems and IDEs and found out that coloring is not present everywhere in principle. Well, okay, it’s missing, so the color marking is also displayed in squiggles. Is there an easy way to somehow define support or otherwise colorize? In general, get rid of artifacts where colorization is not supported.
As an example:


$ echo -e "\e[31mRed Text\e[0m"
$ echo -e "\e[42mGreen Background\e[0m"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2019-05-29
@jcmvbkbc

Is there an easy way to somehow define support

tput colors

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question