2021年5月13日 星期四

[Linux 常見問題] ANSI Color Specific RGB Sequence Bash

 Source From Here

Question
I know that in bash terminals a reliable way to change color is using ANSI escape sequences. For example:
# echo -e "\033[0;31mbrown text\033[0;00m"

should output
brown text (in brown)

Is there a way to output color using a specific RGB set with ANSI? Say I want bright red:
# echo -e "**\033[255:0:0m**red text\033[0;00m"

Does this sort of thing exist?

HowTo
This will work
# echo -e "**\033[38;2;255;0;0m**red text\033[0;00m"

format:
"\033[38;2;R;G;Bm"

* R is your RED component of your RGB
* G is your GRREN component of your RGB
* B is your BLUE component of your RGB

Supplement
W3C School - HTML Color Names

沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...