check_colors: Check colors

Description Usage Arguments Details Value Examples

View source: R/GeneTonic-extras.R

Description

Check correct specification of colors

Usage

1

Arguments

x

A vector of strings specifying colors

Details

This is a vectorized version of grDevices::col2rgb()

Value

A vector of logical values, one for each specified color - TRUE if the color is specified correctly

Examples

1
2
3
4
5
6
7
8
9
# simple case
mypal <- c("steelblue", "#FF1100")
check_colors(mypal)
mypal2 <- rev(
  scales::alpha(
    colorRampPalette(RColorBrewer::brewer.pal(name = "RdYlBu", 11))(50), 0.4))
check_colors(mypal2)
# useful with long vectors to check at once if all cols are fine
all(check_colors(mypal2))

GeneTonic documentation built on Nov. 8, 2020, 5:27 p.m.