Home > Net >  How to display a set of colours that is similar to a specific colour?
How to display a set of colours that is similar to a specific colour?

Time:12-30

I am trying to get a display of the actual build-in colours in R, rather than names. If I use colours(), I get a display of all names. Now I would, for example, like to see 10 colours close to "dodgerblue" together with their names in the console.

Is there a way to do this?

CodePudding user response:

You can try next solution:

  1. Install package rcolorutils

  2. You can find out, which colors are close to your, f.e.:

    nearRcolor("dodgerblue", "rgb", dist = 75) #dist - depth of search
    

An output:

     0.0             19.8             48.4             49.4             53.0 
"dodgerblue"    "dodgerblue2"   "deepskyblue2"     "royalblue1"     "royalblue2" 
        55.8             57.6             59.2             60.4             70.1 
"deepskyblue"    "dodgerblue3"   "deepskyblue3"      "royalblue"     "steelblue2" 
        70.1             72.4             75.4             78.8             79.8 
"steelblue3" "cornflowerblue"     "royalblue3" 
  1. Let's look to our colors:

    nearRcolor("dodgerblue", "rgb", dist = 75) %>%
       plotCol(nrow = 2)
    

enter image description here

CodePudding user response:

For anyone else who is looking: I just found a second way to access a first overview:

demo(colors)

Displays all names in the respective colour, and also gives the plots displayed above for defined colours.

  • Related