Skip to contents

Returns a number of distinct colors based on the RGB scale. When fewer than 444 colors are requested, colors are returned in an order that maximizes differences. When more than 444 colors are requested, a recycled sampling of the available colors is returned.

Usage

getDistinctColors(n, seed = 1234)

Arguments

n

number of colors wanted

seed

seed to use when randomizing color order. Default is 1234

Value

character vector of hexadecimal distinct colors

See also

Other basic color palette functions: getMonochromeColors(), getRainbowColors()

Examples

getDistinctColors(500)
#> Warning: 
#>  not enough unique colors in R, maximum = 444 
#>   [1] "orange4"           "red2"              "tomato"           
#>   [4] "darkseagreen1"     "deeppink3"         "steelblue2"       
#>   [7] "gold1"             "wheat"             "tan4"             
#>  [10] "springgreen2"      "darkred"           "darkseagreen3"    
#>  [13] "lightskyblue"      "darkorange2"       "plum3"            
#>  [16] "darkgoldenrod4"    "skyblue1"          "navajowhite3"     
#>  [19] "snow1"             "lemonchiffon4"     "cornflowerblue"   
#>  [22] "antiquewhite1"     "springgreen2"      "honeydew1"        
#>  [25] "burlywood3"        "lightsalmon4"      "grey56"           
#>  [28] "lightcyan4"        "darkorchid"        "dodgerblue4"      
#>  [31] "springgreen3"      "cornsilk3"         "lavenderblush1"   
#>  [34] "wheat2"            "slateblue3"        "paleturquoise3"   
#>  [37] "deeppink"          "ghostwhite"        "rosybrown4"       
#>  [40] "burlywood4"        "deepskyblue2"      "lightyellow3"     
#>  [43] "powderblue"        "violet"            "palegreen2"       
#>  [46] "palegreen3"        "mediumvioletred"   "deepskyblue4"     
#>  [49] "darkgoldenrod4"    "lemonchiffon2"     "paleturquoise4"   
#>  [52] "seagreen2"         "lemonchiffon4"     "palevioletred1"   
#>  [55] "springgreen4"      "paleturquoise4"    "lightsteelblue1"  
#>  [58] "lightsteelblue4"   "chartreuse2"       "peachpuff1"       
#>  [61] "gold4"             "orange2"           "green3"           
#>  [64] "firebrick"         "mistyrose3"        "magenta2"         
#>  [67] "darkorchid3"       "bisque3"           "orchid1"          
#>  [70] "palegreen1"        "lightsalmon"       "ghostwhite"       
#>  [73] "rosybrown3"        "coral"             "aquamarine2"      
#>  [76] "grey46"            "tomato"            "mediumorchid4"    
#>  [79] "seashell4"         "hotpink"           "ghostwhite"       
#>  [82] "darkolivegreen"    "darkgrey"          "mediumorchid1"    
#>  [85] "mediumorchid4"     "lightskyblue4"     "lightskyblue1"    
#>  [88] "plum3"             "olivedrab1"        "khaki1"           
#>  [91] "cyan3"             "coral4"            "salmon2"          
#>  [94] "grey6"             "plum3"             "snow2"            
#>  [97] "hotpink2"          "powderblue"        "paleturquoise3"   
#> [100] "coral3"            "brown4"            "skyblue4"         
#> [103] "turquoise1"        "bisque"            "goldenrod"        
#> [106] "firebrick3"        "indianred"         "pink1"            
#> [109] "deepskyblue3"      "green3"            "darkseagreen2"    
#> [112] "lightskyblue"      "peachpuff2"        "springgreen4"     
#> [115] "darkolivegreen2"   "darkolivegreen2"   "indianred2"       
#> [118] "darkgoldenrod2"    "azure4"            "firebrick3"       
#> [121] "mistyrose1"        "grey76"            "gainsboro"        
#> [124] "lemonchiffon1"     "navajowhite"       "peachpuff4"       
#> [127] "seagreen"          "ivory"             "lightyellow3"     
#> [130] "olivedrab2"        "wheat4"            "darkseagreen2"    
#> [133] "gold2"             "mistyrose4"        "whitesmoke"       
#> [136] "bisque"            "mediumpurple"      "bisque3"          
#> [139] "yellow2"           "burlywood3"        "blue3"            
#> [142] "seashell4"         "lightblue"         "tan4"             
#> [145] "orchid4"           "darkorange"        "indianred"        
#> [148] "seashell2"         "plum3"             "thistle2"         
#> [151] "skyblue4"          "red1"              "darkolivegreen3"  
#> [154] "green"             "tomato1"           "grey96"           
#> [157] "thistle2"          "greenyellow"       "cyan3"            
#> [160] "slateblue3"        "lightblue3"        "yellow4"          
#> [163] "slateblue3"        "sandybrown"        "blue"             
#> [166] "tan4"              "bisque3"           "lightskyblue1"    
#> [169] "blue2"             "salmon4"           "darkseagreen1"    
#> [172] "yellow4"           "thistle4"          "wheat3"           
#> [175] "violetred2"        "palegreen"         "plum"             
#> [178] "powderblue"        "greenyellow"       "lightblue4"       
#> [181] "slateblue1"        "lightgoldenrod"    "slateblue"        
#> [184] "darkolivegreen1"   "darkolivegreen"    "mediumpurple1"    
#> [187] "salmon2"           "azure4"            "orange1"          
#> [190] "ivory"             "springgreen"       "seagreen1"        
#> [193] "lavenderblush1"    "yellow3"           "blue4"            
#> [196] "aquamarine2"       "bisque3"           "grey66"           
#> [199] "chartreuse2"       "royalblue1"        "darkgreen"        
#> [202] "darkblue"          "honeydew"          "aquamarine4"      
#> [205] "orchid3"           "red3"              "lightcyan4"       
#> [208] "paleturquoise2"    "darkolivegreen3"   "ivory3"           
#> [211] "red4"              "salmon"            "greenyellow"      
#> [214] "green4"            "tomato1"           "darkviolet"       
#> [217] "maroon3"           "blueviolet"        "antiquewhite3"    
#> [220] "mistyrose2"        "powderblue"        "antiquewhite1"    
#> [223] "cadetblue1"        "lightblue4"        "tan3"             
#> [226] "thistle"           "khaki3"            "burlywood2"       
#> [229] "palegreen2"        "lightskyblue2"     "magenta3"         
#> [232] "orchid1"           "coral1"            "thistle1"         
#> [235] "steelblue4"        "lemonchiffon4"     "lightyellow"      
#> [238] "steelblue1"        "bisque3"           "khaki2"           
#> [241] "seagreen1"         "skyblue1"          "darkgoldenrod1"   
#> [244] "cornsilk"          "khaki2"            "honeydew"         
#> [247] "violetred"         "coral4"            "skyblue3"         
#> [250] "cyan2"             "coral2"            "ghostwhite"       
#> [253] "orchid2"           "lightpink"         "lightyellow2"     
#> [256] "mediumblue"        "turquoise2"        "cornsilk2"        
#> [259] "blue4"             "grey66"            "yellow"           
#> [262] "coral4"            "aquamarine2"       "thistle4"         
#> [265] "tan1"              "lightpink1"        "orangered"        
#> [268] "darkorchid2"       "orangered4"        "yellow1"          
#> [271] "moccasin"          "lightpink2"        "darkseagreen4"    
#> [274] "lightsalmon2"      "indianred1"        "cornsilk3"        
#> [277] "darkorange"        "seagreen2"         "darkorange1"      
#> [280] "palevioletred3"    "green"             "orchid4"          
#> [283] "violetred4"        "lightpink"         "indianred2"       
#> [286] "yellow2"           "peachpuff4"        "lightsteelblue"   
#> [289] "seashell"          "grey16"            "deepskyblue3"     
#> [292] "violetred"         "azure2"            "mediumseagreen"   
#> [295] "lightseagreen"     "orchid"            "orange1"          
#> [298] "lavenderblush4"    "yellow"            "darkviolet"       
#> [301] "deepskyblue2"      "ivory2"            "slateblue1"       
#> [304] "lightcyan3"        "limegreen"         "springgreen3"     
#> [307] "snow1"             "darkolivegreen4"   "seashell4"        
#> [310] "slateblue2"        "grey16"            "violetred4"       
#> [313] "papayawhip"        "hotpink2"          "ivory3"           
#> [316] "lightpink4"        "lightskyblue"      "darkslateblue"    
#> [319] "darkgoldenrod"     "orange"            "grey56"           
#> [322] "springgreen3"      "mediumpurple2"     "linen"            
#> [325] "chocolate"         "orchid4"           "darkseagreen1"    
#> [328] "darkseagreen"      "tomato1"           "lightblue3"       
#> [331] "goldenrod4"        "turquoise1"        "mediumvioletred"  
#> [334] "slateblue3"        "slateblue3"        "brown4"           
#> [337] "deepskyblue1"      "olivedrab1"        "seashell1"        
#> [340] "springgreen"       "navyblue"          "lightgoldenrod"   
#> [343] "darkolivegreen3"   "goldenrod1"        "royalblue"        
#> [346] "lightsalmon3"      "yellow2"           "khaki1"           
#> [349] "hotpink2"          "lightskyblue1"     "darkgoldenrod4"   
#> [352] "blue4"             "grey86"            "rosybrown"        
#> [355] "dodgerblue4"       "lightgreen"        "lightpink2"       
#> [358] "violetred"         "plum3"             "lightblue3"       
#> [361] "rosybrown3"        "darksalmon"        "skyblue"          
#> [364] "slateblue4"        "darkorchid4"       "chartreuse2"      
#> [367] "mediumaquamarine"  "lavenderblush1"    "paleturquoise2"   
#> [370] "mintcream"         "lightblue3"        "green"            
#> [373] "lavenderblush"     "green3"            "cadetblue"        
#> [376] "yellow4"           "lemonchiffon3"     "royalblue3"       
#> [379] "skyblue3"          "darkcyan"          "navyblue"         
#> [382] "green"             "lightskyblue"      "dodgerblue"       
#> [385] "navajowhite4"      "burlywood2"        "palevioletred3"   
#> [388] "seagreen1"         "mediumpurple3"     "hotpink2"         
#> [391] "palevioletred3"    "ivory3"            "tan1"             
#> [394] "coral4"            "chocolate2"        "palevioletred2"   
#> [397] "powderblue"        "maroon3"           "lawngreen"        
#> [400] "sienna4"           "navy"              "darkgoldenrod1"   
#> [403] "darkolivegreen4"   "lightsteelblue4"   "red1"             
#> [406] "ivory1"            "azure"             "firebrick2"       
#> [409] "azure1"            "burlywood4"        "greenyellow"      
#> [412] "cornsilk1"         "brown1"            "mintcream"        
#> [415] "tomato2"           "red"               "darkorchid2"      
#> [418] "aquamarine2"       "slateblue"         "navajowhite2"     
#> [421] "purple4"           "lightslateblue"    "magenta2"         
#> [424] "mediumblue"        "tan3"              "chocolate1"       
#> [427] "sienna1"           "seashell2"         "violetred3"       
#> [430] "lightslateblue"    "chocolate2"        "firebrick"        
#> [433] "lavenderblush3"    "snow2"             "navajowhite3"     
#> [436] "green"             "pink1"             "oldlace"          
#> [439] "mediumspringgreen" "lightskyblue"      "khaki"            
#> [442] "goldenrod4"        "olivedrab1"        "darkorchid2"      
#> [445] "lightcyan"         "purple2"           "midnightblue"     
#> [448] "lemonchiffon2"     "blueviolet"        "whitesmoke"       
#> [451] "darkcyan"          "khaki2"            "beige"            
#> [454] "hotpink1"          "cornsilk4"         "mintcream"        
#> [457] "sienna1"           "olivedrab2"        "lemonchiffon2"    
#> [460] "brown2"            "green1"            "chartreuse3"      
#> [463] "palevioletred3"    "ivory3"            "darkslateblue"    
#> [466] "bisque"            "honeydew4"         "darkorchid1"      
#> [469] "royalblue3"        "wheat2"            "salmon"           
#> [472] "firebrick4"        "purple3"           "plum"             
#> [475] "yellow3"           "lavenderblush3"    "blueviolet"       
#> [478] "brown3"            "lightsalmon4"      "palevioletred2"   
#> [481] "darkseagreen3"     "cyan"              "goldenrod4"       
#> [484] "lightsalmon"       "salmon1"           "chartreuse2"      
#> [487] "aquamarine3"       "honeydew1"         "snow1"            
#> [490] "darkgoldenrod4"    "saddlebrown"       "lightsalmon2"     
#> [493] "lightgoldenrod3"   "lightcyan3"        "seagreen1"        
#> [496] "palevioletred4"    "bisque"            "lightskyblue4"    
#> [499] "darkslateblue"     "palegoldenrod"    
getDistinctColors(500, seed = 1)
#> Warning: 
#>  not enough unique colors in R, maximum = 444 
#>   [1] "plum1"                "ivory4"               "forestgreen"         
#>   [4] "violetred1"           "palegreen3"           "navajowhite3"        
#>   [7] "lightblue2"           "palevioletred1"       "darkolivegreen2"     
#>  [10] "olivedrab2"           "seashell1"            "grey36"              
#>  [13] "purple1"              "mistyrose2"           "purple"              
#>  [16] "darkgoldenrod4"       "lightseagreen"        "burlywood"           
#>  [19] "darkslateblue"        "lightskyblue3"        "sienna"              
#>  [22] "ivory2"               "orchid"               "seashell1"           
#>  [25] "snow1"                "darkorange1"          "yellow"              
#>  [28] "orangered4"           "rosybrown1"           "violetred2"          
#>  [31] "plum3"                "purple1"              "cadetblue"           
#>  [34] "wheat"                "deeppink3"            "thistle3"            
#>  [37] "turquoise1"           "bisque1"              "cadetblue2"          
#>  [40] "slateblue1"           "rosybrown4"           "cyan2"               
#>  [43] "dodgerblue3"          "burlywood3"           "khaki4"              
#>  [46] "blanchedalmond"       "skyblue4"             "mediumorchid4"       
#>  [49] "lightgoldenrod2"      "slateblue2"           "burlywood2"          
#>  [52] "grey6"                "palegreen2"           "springgreen4"        
#>  [55] "orange"               "indianred2"           "azure1"              
#>  [58] "gainsboro"            "cadetblue3"           "thistle1"            
#>  [61] "bisque3"              "lightpink3"           "limegreen"           
#>  [64] "lightcyan2"           "skyblue"              "darkseagreen4"       
#>  [67] "plum3"                "mediumslateblue"      "plum3"               
#>  [70] "darkseagreen4"        "darkseagreen3"        "purple2"             
#>  [73] "azure"                "palegreen"            "lightskyblue3"       
#>  [76] "lavenderblush2"       "royalblue1"           "olivedrab4"          
#>  [79] "deeppink2"            "darkolivegreen1"      "seagreen3"           
#>  [82] "blue3"                "goldenrod4"           "mediumpurple3"       
#>  [85] "tomato"               "lightsteelblue1"      "turquoise1"          
#>  [88] "deeppink"             "paleturquoise3"       "brown1"              
#>  [91] "cadetblue3"           "honeydew1"            "orangered2"          
#>  [94] "darkseagreen2"        "green3"               "purple"              
#>  [97] "rosybrown4"           "rosybrown"            "dodgerblue"          
#> [100] "royalblue2"           "paleturquoise3"       "darkviolet"          
#> [103] "cornsilk1"            "lightsteelblue4"      "darkseagreen3"       
#> [106] "peachpuff4"           "chartreuse4"          "lightsteelblue1"     
#> [109] "orchid"               "goldenrod1"           "forestgreen"         
#> [112] "palegreen3"           "grey86"               "orange2"             
#> [115] "green1"               "grey76"               "orangered"           
#> [118] "tomato2"              "khaki2"               "chartreuse1"         
#> [121] "lightpink1"           "palegoldenrod"        "black"               
#> [124] "lemonchiffon1"        "lightskyblue"         "palegreen"           
#> [127] "lightyellow"          "rosybrown"            "royalblue2"          
#> [130] "ivory"                "cadetblue1"           "white"               
#> [133] "blue3"                "darkgoldenrod3"       "tomato"              
#> [136] "plum3"                "orange4"              "deepskyblue3"        
#> [139] "magenta1"             "orchid3"              "coral4"              
#> [142] "yellow2"              "sienna3"              "darkolivegreen3"     
#> [145] "plum4"                "deeppink2"            "sandybrown"          
#> [148] "palevioletred1"       "palegreen4"           "chartreuse2"         
#> [151] "seashell"             "peachpuff4"           "mediumaquamarine"    
#> [154] "grey56"               "mediumorchid2"        "paleturquoise4"      
#> [157] "palevioletred"        "mediumorchid3"        "maroon2"             
#> [160] "lightslateblue"       "gold3"                "deeppink3"           
#> [163] "bisque1"              "slateblue1"           "tomato2"             
#> [166] "chartreuse4"          "chocolate1"           "tan4"                
#> [169] "seagreen"             "gainsboro"            "paleturquoise3"      
#> [172] "cornsilk2"            "palegreen4"           "seagreen3"           
#> [175] "darkslateblue"        "firebrick1"           "darkgoldenrod2"      
#> [178] "lightskyblue4"        "darkred"              "lightcyan3"          
#> [181] "bisque"               "navyblue"             "violetred1"          
#> [184] "blueviolet"           "violetred2"           "sandybrown"          
#> [187] "lavenderblush"        "thistle2"             "maroon"              
#> [190] "darkgoldenrod"        "azure3"               "burlywood3"          
#> [193] "mistyrose4"           "palevioletred"        "darkorange4"         
#> [196] "dodgerblue4"          "honeydew4"            "goldenrod1"          
#> [199] "lightpink4"           "mediumpurple"         "indianred2"          
#> [202] "lightyellow4"         "wheat1"               "violetred4"          
#> [205] "goldenrod3"           "firebrick3"           "azure1"              
#> [208] "deepskyblue3"         "azure3"               "navajowhite4"        
#> [211] "gainsboro"            "cornsilk2"            "seagreen2"           
#> [214] "navyblue"             "lightsalmon4"         "firebrick4"          
#> [217] "gold1"                "burlywood4"           "seashell3"           
#> [220] "turquoise4"           "skyblue2"             "powderblue"          
#> [223] "brown4"               "paleturquoise4"       "palegreen1"          
#> [226] "turquoise2"           "cornsilk1"            "forestgreen"         
#> [229] "palevioletred3"       "lightsalmon4"         "seashell1"           
#> [232] "grey66"               "royalblue"            "deepskyblue4"        
#> [235] "palevioletred3"       "darkseagreen2"        "chartreuse3"         
#> [238] "red2"                 "orangered1"           "mediumseagreen"      
#> [241] "saddlebrown"          "springgreen"          "cyan4"               
#> [244] "snow1"                "darkgoldenrod3"       "violetred3"          
#> [247] "khaki"                "violetred4"           "powderblue"          
#> [250] "grey56"               "deepskyblue3"         "seagreen"            
#> [253] "deepskyblue"          "magenta2"             "dodgerblue3"         
#> [256] "darkblue"             "blue1"                "burlywood4"          
#> [259] "azure2"               "grey66"               "orchid4"             
#> [262] "cornflowerblue"       "springgreen4"         "gold"                
#> [265] "brown3"               "snow"                 "sandybrown"          
#> [268] "darkgoldenrod2"       "darkslateblue"        "lightblue"           
#> [271] "plum4"                "hotpink"              "blueviolet"          
#> [274] "burlywood"            "mediumslateblue"      "linen"               
#> [277] "blue2"                "cornflowerblue"       "honeydew"            
#> [280] "orangered"            "firebrick4"           "palegreen2"          
#> [283] "coral3"               "orange4"              "red"                 
#> [286] "blueviolet"           "navajowhite1"         "darkorchid"          
#> [289] "red2"                 "palegreen4"           "lightgreen"          
#> [292] "darkred"              "orange2"              "maroon4"             
#> [295] "brown1"               "gold"                 "grey26"              
#> [298] "deepskyblue4"         "darkolivegreen3"      "lightskyblue3"       
#> [301] "orange"               "orchid3"              "deeppink"            
#> [304] "navajowhite4"         "navajowhite3"         "maroon2"             
#> [307] "lightsalmon1"         "red4"                 "darkorchid4"         
#> [310] "lightsteelblue4"      "cyan4"                "chocolate1"          
#> [313] "chocolate4"           "linen"                "lightgoldenrod3"     
#> [316] "darkgrey"             "mediumspringgreen"    "lightgoldenrodyellow"
#> [319] "thistle3"             "salmon4"              "seagreen1"           
#> [322] "saddlebrown"          "darkgoldenrod"        "aliceblue"           
#> [325] "deepskyblue3"         "ghostwhite"           "sienna1"             
#> [328] "wheat"                "magenta1"             "navajowhite4"        
#> [331] "hotpink3"             "grey46"               "lightgoldenrod1"     
#> [334] "lightsteelblue"       "violetred4"           "palegreen3"          
#> [337] "magenta3"             "white"                "lavender"            
#> [340] "salmon3"              "darkolivegreen"       "tomato1"             
#> [343] "plum1"                "lightsalmon"          "lightslateblue"      
#> [346] "lightblue"            "darkseagreen3"        "snow2"               
#> [349] "seagreen2"            "mediumpurple4"        "lemonchiffon"        
#> [352] "indianred4"           "lightsteelblue1"      "ivory"               
#> [355] "purple1"              "grey96"               "ivory4"              
#> [358] "chartreuse2"          "lightcoral"           "indianred3"          
#> [361] "orchid1"              "steelblue4"           "goldenrod4"          
#> [364] "mediumorchid3"        "darkgrey"             "lightyellow4"        
#> [367] "peachpuff4"           "royalblue2"           "royalblue2"          
#> [370] "sienna2"              "wheat2"               "indianred4"          
#> [373] "plum1"                "chocolate4"           "blanchedalmond"      
#> [376] "wheat"                "darkkhaki"            "purple"              
#> [379] "yellow1"              "lightsteelblue2"      "purple"              
#> [382] "lightpink"            "tomato"               "darkseagreen4"       
#> [385] "antiquewhite"         "lawngreen"            "greenyellow"         
#> [388] "indianred3"           "snow3"                "grey16"              
#> [391] "firebrick4"           "mintcream"            "lightpink2"          
#> [394] "coral3"               "pink3"                "lemonchiffon1"       
#> [397] "gold1"                "darkturquoise"        "yellow"              
#> [400] "brown3"               "slateblue1"           "olivedrab4"          
#> [403] "turquoise2"           "skyblue2"             "orchid1"             
#> [406] "ivory1"               "skyblue4"             "darksalmon"          
#> [409] "ivory"                "honeydew"             "honeydew2"           
#> [412] "dodgerblue3"          "khaki1"               "darkolivegreen3"     
#> [415] "deeppink"             "mediumslateblue"      "beige"               
#> [418] "cadetblue2"           "wheat1"               "orangered"           
#> [421] "darkorange3"          "ivory1"               "brown"               
#> [424] "chartreuse4"          "dodgerblue1"          "lightyellow4"        
#> [427] "chartreuse4"          "mediumorchid3"        "snow"                
#> [430] "grey16"               "darkorange1"          "thistle4"            
#> [433] "bisque2"              "darkgoldenrod4"       "skyblue"             
#> [436] "seagreen1"            "lightcyan1"           "red"                 
#> [439] "cyan3"                "snow3"                "peachpuff3"          
#> [442] "lightslateblue"       "royalblue2"           "turquoise3"          
#> [445] "coral1"               "navajowhite4"         "deepskyblue1"        
#> [448] "pink2"                "springgreen4"         "brown2"              
#> [451] "olivedrab2"           "white"                "navyblue"            
#> [454] "lightpink2"           "cornflowerblue"       "deepskyblue4"        
#> [457] "paleturquoise"        "khaki"                "pink4"               
#> [460] "burlywood4"           "dodgerblue3"          "steelblue1"          
#> [463] "mediumorchid4"        "orange1"              "thistle3"            
#> [466] "maroon1"              "dodgerblue4"          "lightsalmon4"        
#> [469] "antiquewhite2"        "purple1"              "bisque1"             
#> [472] "lemonchiffon3"        "chocolate4"           "darkgoldenrod4"      
#> [475] "turquoise2"           "aliceblue"            "snow4"               
#> [478] "peachpuff4"           "cyan1"                "coral1"              
#> [481] "lightyellow4"         "palegreen"            "goldenrod4"          
#> [484] "orange1"              "gold"                 "cadetblue"           
#> [487] "firebrick"            "mediumaquamarine"     "gold1"               
#> [490] "grey16"               "lightcyan2"           "orchid4"             
#> [493] "maroon1"              "tan1"                 "mistyrose3"          
#> [496] "lavenderblush3"       "darkolivegreen"       "yellow4"             
#> [499] "paleturquoise2"       "darkorange4"