Skip to contents

[DT][echarts4r][ggplot2][gt][plotly]

This function checks if each color in the provided vector is a valid hex color code in the format #RRGGBB. If any invalid color codes are found, an error message is triggered. It is a helper function (not exported) used both in ro_color_seq and ro_show_colors

Usage

ro_color_validate(colors)

Arguments

colors

A character vector of color codes to validate.

Value

The input colors vector is returned invisibly if all color codes are valid. If any color code is invalid, an error is triggered.

Examples

valid_colors <- c("#FF5733", "#33FF57", "#3357FF")
invalid_colors <- c("#FF5733", "33FF57", "#ZZZZZZ")

# This will pass without errors
ROvis.utils:::ro_color_validate(valid_colors)

# This will trigger an error
if (FALSE) { # \dontrun{
ROvis.utils:::ro_color_validate(invalid_colors)
} # }