Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 1.17 KB

readme.md

File metadata and controls

37 lines (25 loc) · 1.17 KB

cor

cor is similar to the cat command, but outputs the file contents with colored hexadecimal triplets (e.g. #f00 with a red background).

Build instructions

make

How it works?

Using a terminal supporting "true color", it is possible to use these ANSI escape sequences:

ESC[38;2;⟨r⟩;⟨g⟩;⟨b⟩m Select RGB foreground color
ESC[48;2;⟨r⟩;⟨g⟩;⟨b⟩m Select RGB background color

In practice, this means that you can show the text 'TRUECOLOR' in orange in your terminal supporting "true color" this way:

printf '\033[38;2;255;100;0m%s\033[0m\n' TRUECOLOR

See also

  • cor --help
  • ap/vim-css-color: A Vim plugin to preview colors in source code while editing.

    • The inspiration for cor (which, by the way, means color in Portuguese)