Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R: a cat of many colors

Tags:

r

colors

cat

I am wondering if it is possible to specify color options when displaying text with the cat command or a similar command. The reason I ask is because I have set up and interactive feedback system with a simulation I am working on and would like to provide more information to the display as the simulation which takes hours to run is being processed.

like image 228
Francis Smart Avatar asked Jul 26 '14 04:07

Francis Smart


People also ask

What is a cat with many colors called?

Calico cats have at least three colors in their fur, which at their most basic are white, orange, and black. However, variations on these colors, such as cream, blue-black, reddish, brown might also be noted in the coat of a Calico cat.

How many colors of cat are there?

Generally, the colours, which can be termed differently depending on the breed, are: white, red, blue, black, cream, cinnamon, fawn and brown. The colour of a cat depends completely on genetics. The two primary colours in cats are black and red.

What is a cat with 4 colors called?

Torbie Cats Of the four type of cat coat colors listed, the torbie cat is most rare.

Are cats with 3 colors rare?

Genetics are the reason calico tomcats are so rare. Coat color in cats is typically a sex-linked trait—in other words, color is coded into certain chromosomes. 2 Both male and female cats can be orange (a mutant gene) or black because the gene that controls those colors is on the X chromosome.


1 Answers

See this file from the testthat package for an excellent example on how to create colored text: https://github.com/hadley/testthat/blob/717b02164def5c1f027d3a20b889dae35428b6d7/R/colour-text.r

You can just use this colourise function to add color to your text. The file also has a bunch of predefined colors.

EDIT

There is now an R package for ANSI colors on CRAN, it is called crayon. Disclaimer: I am the package author. http://cran.r-project.org/web/packages/crayon/index.html https://github.com/gaborcsardi/crayon

like image 138
Gabor Csardi Avatar answered Oct 21 '22 13:10

Gabor Csardi