Skip to contents

This function displays color palettes using ggplot2.

Usage

show_palettes(
  palettes = NULL,
  type = c("discrete", "continuous"),
  index = NULL,
  palette_names = NULL,
  return_names = TRUE,
  return_palettes = FALSE
)

Arguments

palettes

A list of color palettes. If `NULL`, uses default palettes.

type

A character vector specifying the type of palettes to include. Default is "discrete".

index

A numeric vector specifying the indices of the palettes to include. Default is `NULL`.

palette_names

A character vector specifying the names of the SCP palettes to include. Default is `NULL`.

return_names

A logical value indicating whether to return the names of the selected palettes. Default is `TRUE`.

return_palettes

A logical value indicating whether to return the colors of selected palettes. Default is `FALSE`.

Examples

show_palettes(palettes = list(c("red", "blue", "green"), c("yellow", "purple", "orange")))

#> [1] "1" "2"
all_palettes <- show_palettes(return_palettes = TRUE)

names(all_palettes)
#>   [1] "BrBG"                   "PiYG"                   "PRGn"                   "PuOr"                  
#>   [5] "RdBu"                   "RdGy"                   "RdYlBu"                 "RdYlGn"                
#>   [9] "Spectral"               "Accent"                 "Dark2"                  "Paired"                
#>  [13] "Pastel1"                "Pastel2"                "Set1"                   "Set2"                  
#>  [17] "Set3"                   "Blues"                  "BuGn"                   "BuPu"                  
#>  [21] "GnBu"                   "Greens"                 "Greys"                  "Oranges"               
#>  [25] "OrRd"                   "PuBu"                   "PuBuGn"                 "PuRd"                  
#>  [29] "Purples"                "RdPu"                   "Reds"                   "YlGn"                  
#>  [33] "YlGnBu"                 "YlOrBr"                 "YlOrRd"                 "npg"                   
#>  [37] "aaas"                   "nejm"                   "lancet"                 "jama"                  
#>  [41] "jco"                    "ucscgb"                 "d3-category10"          "d3-category20"         
#>  [45] "d3-category20b"         "d3-category20c"         "igv"                    "locuszoom"             
#>  [49] "uchicago-default"       "uchicago-light"         "uchicago-dark"          "cosmic"                
#>  [53] "simpsons"               "futurama"               "rickandmorty"           "startrek"              
#>  [57] "tron"                   "frontiers"              "flatui"                 "gsea"                  
#>  [61] "material-red"           "material-pink"          "material-purple"        "material-deep-purple"  
#>  [65] "material-indigo"        "material-blue"          "material-light-blue"    "material-cyan"         
#>  [69] "material-teal"          "material-green"         "material-light-green"   "material-lime"         
#>  [73] "material-yellow"        "material-amber"         "material-orange"        "material-deep-orange"  
#>  [77] "material-brown"         "material-grey"          "material-blue-grey"     "dPBIYlBu"              
#>  [81] "dPBIYlPu"               "dPBIPuGn"               "dPBIPuOr"               "dPBIRdBu"              
#>  [85] "dPBIRdGy"               "dPBIRdGn"               "qMSOStd"                "qMSO12"                
#>  [89] "qMSO15"                 "qMSOBuWarm"             "qMSOBu"                 "qMSOBu2"               
#>  [93] "qMSOBuGn"               "qMSOGn"                 "qMSOGnYl"               "qMSOYl"                
#>  [97] "qMSOYlOr"               "qMSOOr"                 "qMSOOrRd"               "qMSORdOr"              
#> [101] "qMSORd"                 "qMSORdPu"               "qMSOPu"                 "qMSOPu2"               
#> [105] "qMSOMed"                "qMSOPap"                "qMSOMrq"                "qMSOSlp"               
#> [109] "qMSOAsp"                "qPBI"                   "sPBIGn"                 "sPBIGy1"               
#> [113] "sPBIRd"                 "sPBIYl"                 "sPBIGy2"                "sPBIBu"                
#> [117] "sPBIOr"                 "sPBIPu"                 "sPBIYlGn"               "sPBIRdPu"              
#> [121] "ag_GrnYl"               "ag_Sunset"              "ArmyRose"               "Earth"                 
#> [125] "Fall"                   "Geyser"                 "TealRose"               "Temps"                 
#> [129] "Tropic"                 "Antique"                "Bold"                   "Pastel"                
#> [133] "Prism"                  "Safe"                   "Vivid"                  "BluGrn"                
#> [137] "BluYl"                  "BrwnYl"                 "Burg"                   "BurgYl"                
#> [141] "DarkMint"               "Emrld"                  "Magenta"                "Mint"                  
#> [145] "OrYel"                  "Peach"                  "PinkYl"                 "Purp"                  
#> [149] "PurpOr"                 "RedOr"                  "Sunset"                 "SunsetDark"            
#> [153] "Teal"                   "TealGrn"                "polarnight"             "snowstorm"             
#> [157] "frost"                  "aurora"                 "lumina"                 "mountain_forms"        
#> [161] "silver_mine"            "lake_superior"          "victory_bonds"          "halifax_harbor"        
#> [165] "moose_pond"             "algoma_forest"          "rocky_mountain"         "red_mountain"          
#> [169] "baie_mouton"            "afternoon_prarie"       "magma"                  "inferno"               
#> [173] "plasma"                 "viridis"                "cividis"                "rocket"                
#> [177] "mako"                   "turbo"                  "ocean.algae"            "ocean.deep"            
#> [181] "ocean.dense"            "ocean.gray"             "ocean.haline"           "ocean.ice"             
#> [185] "ocean.matter"           "ocean.oxy"              "ocean.phase"            "ocean.solar"           
#> [189] "ocean.thermal"          "ocean.turbid"           "ocean.balance"          "ocean.curl"            
#> [193] "ocean.delta"            "ocean.amp"              "ocean.speed"            "ocean.tempo"           
#> [197] "BrowntoBlue.10"         "BrowntoBlue.12"         "BluetoDarkOrange.12"    "BluetoDarkOrange.18"   
#> [201] "DarkRedtoBlue.12"       "DarkRedtoBlue.18"       "BluetoGreen.14"         "BluetoGray.8"          
#> [205] "BluetoOrangeRed.14"     "BluetoOrange.10"        "BluetoOrange.12"        "BluetoOrange.8"        
#> [209] "LightBluetoDarkBlue.10" "LightBluetoDarkBlue.7"  "Categorical.12"         "GreentoMagenta.16"     
#> [213] "SteppedSequential.5"    "jcolors-default"        "jcolors-pal2"           "jcolors-pal3"          
#> [217] "jcolors-pal4"           "jcolors-pal5"           "jcolors-pal6"           "jcolors-pal7"          
#> [221] "jcolors-pal8"           "jcolors-pal9"           "jcolors-pal10"          "jcolors-pal11"         
#> [225] "jcolors-pal12"          "jcolors-rainbow"        "jet"                    "simspec"               
#> [229] "GdRd"                  
all_palettes[["simspec"]]
#>  [1] "#c22b86" "#f769a1" "#fcc5c1" "#253777" "#1d92c0" "#9ec9e1" "#015b33" "#42aa5e" "#d9f0a2" "#E66F00" "#f18c28"
#> [12] "#FFBB61"
#> attr(,"type")
#> [1] "discrete"
show_palettes(index = 1:10)

#>  [1] "BrBG"     "PiYG"     "PRGn"     "PuOr"     "RdBu"     "RdGy"     "RdYlBu"   "RdYlGn"   "Spectral" "Accent"  
show_palettes(type = "discrete", index = 1:10)

#>  [1] "Accent"  "Dark2"   "Paired"  "Pastel1" "Pastel2" "Set1"    "Set2"    "Set3"    "npg"     "aaas"   
show_palettes(type = "continuous", index = 1:10)

#>  [1] "BrBG"     "PiYG"     "PRGn"     "PuOr"     "RdBu"     "RdGy"     "RdYlBu"   "RdYlGn"   "Spectral" "Blues"   
show_palettes(palette_names = c("Paired", "nejm", "simspec", "Spectral", "jet"), return_palettes = TRUE)

#> $Paired
#>  [1] "#A6CEE3" "#1F78B4" "#B2DF8A" "#33A02C" "#FDBF6F" "#FF7F00" "#FB9A99" "#E31A1C" "#CAB2D6" "#6A3D9A" "#FFFF99"
#> [12] "#B15928"
#> attr(,"type")
#> [1] "discrete"
#> 
#> $nejm
#>      TallPoppy   DeepCerulean           Zest     Eucalyptus WildBlueYonder         Gothic        Salomie     FrenchRose 
#>      "#BC3C29"      "#0072B5"      "#E18727"      "#20854E"      "#7876B1"      "#6F99AD"      "#FFDC91"      "#EE4C97" 
#> attr(,"type")
#> [1] "discrete"
#> 
#> $simspec
#>  [1] "#c22b86" "#f769a1" "#fcc5c1" "#253777" "#1d92c0" "#9ec9e1" "#015b33" "#42aa5e" "#d9f0a2" "#E66F00" "#f18c28"
#> [12] "#FFBB61"
#> attr(,"type")
#> [1] "discrete"
#> 
#> $Spectral
#>  [1] "#5E4FA2" "#3288BD" "#66C2A5" "#ABDDA4" "#E6F598" "#FFFFBF" "#FEE08B" "#FDAE61" "#F46D43" "#D53E4F" "#9E0142"
#> attr(,"type")
#> [1] "continuous"
#> 
#> $jet
#>   [1] "#00007A" "#000085" "#00008F" "#000099" "#0000A3" "#0000AD" "#0000B8" "#0000C2" "#0000CC" "#0000D6" "#0000E0"
#>  [12] "#0000EB" "#0000F5" "#0000FF" "#000AFF" "#0014FF" "#001FFF" "#0029FF" "#0033FF" "#003DFF" "#0047FF" "#0052FF"
#>  [23] "#005CFF" "#0066FF" "#0070FF" "#007AFF" "#0085FF" "#008FFF" "#0099FF" "#00A3FF" "#00ADFF" "#00B8FF" "#00C2FF"
#>  [34] "#00CCFF" "#00D6FF" "#00E0FF" "#00EBFF" "#00F5FF" "#00FFFF" "#0AFFF5" "#14FFEB" "#1FFFE0" "#29FFD6" "#33FFCC"
#>  [45] "#3DFFC2" "#47FFB8" "#52FFAD" "#5CFFA3" "#66FF99" "#70FF8F" "#7AFF85" "#85FF7A" "#8FFF70" "#99FF66" "#A3FF5C"
#>  [56] "#ADFF52" "#B8FF47" "#C2FF3D" "#CCFF33" "#D6FF29" "#E0FF1F" "#EBFF14" "#F5FF0A" "#FFFF00" "#FFF500" "#FFEB00"
#>  [67] "#FFE000" "#FFD600" "#FFCC00" "#FFC200" "#FFB800" "#FFAD00" "#FFA300" "#FF9900" "#FF8F00" "#FF8500" "#FF7A00"
#>  [78] "#FF7000" "#FF6600" "#FF5C00" "#FF5200" "#FF4700" "#FF3D00" "#FF3300" "#FF2900" "#FF1F00" "#FF1400" "#FF0A00"
#>  [89] "#FF0000" "#F50000" "#EB0000" "#E00000" "#D60000" "#CC0000" "#C20000" "#B80000" "#AD0000" "#A30000" "#990000"
#> [100] "#8F0000"
#> attr(,"type")
#> [1] "continuous"
#>