Package 'rcolors'

Title: 270 'NCL' Color Tables in R Language
Description: 'NCL' (NCAR Command Language) is one of the most popular spatial data mapping tools in meteorology studies, due to its beautiful output figures with plenty of color palettes designed by experts <https://www.ncl.ucar.edu/index.shtml>. Here we translate all 'NCL' color palettes into R hexadecimal RGB colors and provide color selection function, which will help users make a beautiful figure.
Authors: Dongdong Kong [aut, cre]
Maintainer: Dongdong Kong <[email protected]>
License: GPL-3
Version: 0.1.1
Built: 2024-11-11 05:15:04 UTC
Source: https://github.com/rpkgs/rcolors

Help Index


col2hex

Description

col2hex

Usage

col2hex(col = "grey80")

Arguments

col

character, color name

Value

character, hex color

Examples

col2hex("grey80")

Get and interpolate colors

Description

Get and interpolate colors

Usage

get_color(col, n = NULL, show = FALSE)

Arguments

col

color name in the rcolors or a vector of colors

n

Integer, default is length of col

show

Boolean, whether to visualize those colors?

Details

⁠supported col names⁠: 270 ncl colors (names(rcolors)) and 35 RColorBrewer colors (names(colors_group$brewer)).

Value

A character vector with elements of 7 or 9 characters, "#" followed by the red, blue, green and optionally alpha values in hexadecimal (after rescaling to 0 ... 255). The optional alpha values range from 0 (fully transparent) to 255 (opaque).

R does not use ‘premultiplied alpha’.

See Also

show_cols()

Examples

print(names(rcolors[1:6]))
print(names(colors_group$brewer))
get_color("amwg_blueyellowred", n = 20)

Show list of colors

Description

Show list of colors

  • show_cols: show list of colors

  • show_cols_brewer: show list of colors in RColorBrewer style

Usage

show_cols(colors_list, margin = 8, fontsize = 1, family = NULL)

show_cols_brewer(colors_list)

show_col(colors, labels = TRUE, borders = NULL, cex_label = 1, nrow = NULL)

Arguments

colors_list

A list objects filled with colors_list or a color vector

margin

margin in the left

family, fontsize

font family and size of color names in the left

colors

a character vector of colors

labels

boolean, whether to show the hexadecimal representation of the colours in each tile

borders

colour of the borders of the tiles

cex_label

size of printed labels, works the same as cex parameter of plot()

nrow

integer, number of rows

Examples

print(names(colors_group))
show_cols(colors_group$rainbow, margin = 14)