Open In App

Get a List of all the 657 colors in R Programming – colors() Function

colors() function in R Language is used to show all the 657 color names that are contained in R programming.
 

Syntax: colors()
Parameters: 
Does not accept any parameters. 
 



Example 1: 
 




# R program to illustrate
# colors function
 
# Calling the colors() function
# to show all the 657 colors that
# names are contained in
# R programming
colors()

Output: 
 



[1] "white"                "aliceblue"            "antiquewhite"        
[4] "antiquewhite1"        "antiquewhite2"        "antiquewhite3"       
[7] "antiquewhite4"        "aquamarine"           "aquamarine1"
...
...
[655] "yellow3"              "yellow4"              "yellowgreen"

Example 2: 
 




# R program to illustrate
# colors function
 
# Calling the colors() function
# with specific serial number of
# color names contained in R
# Programming
colors()[1]
colors()[3]
colors()[10]
colors()[655]
colors()[656]

Output: 
 

[1] "white"
[1] "antiquewhite"
[1] "aquamarine2"
[1] "yellow3"
[1] "yellow4"

 

Article Tags :