1- # ' FlatPlot Colour Selection (Multiple Colors )
1+ # ' FlatPlot Colour Selection (Multiple Colours )
22# '
3- # ' @param keys character vector of color names/codes, can be "rl_green", "rl_red", "rl_blue",
4- # ' "rl_yellow", "rl_purple", "rl_orange", "rl_magenta", hex colours, or valid R color names
3+ # ' This function takes a character vector of color names/codes and returns a
4+ # ' character vector of hex colours. It uses the `get_fp_colour` function to
5+ # ' convert each color name/code to its corresponding hex colour. The input can
6+ # ' include predefined color names like "rl_green", "rl_red", etc., as well as
7+ # ' hex color codes or valid R color names. Use of `get_fp_colors` is valid too.
8+ # '
9+ # ' @param keys character vector of color names/codes, can be "rl_green",
10+ # ' "rl_red", "rl_blue", "rl_yellow", "rl_purple", "rl_orange", "rl_magenta",
11+ # ' "rl_inv", or hex colours, or valid R color names
512# '
613# ' @return character vector of hex colours
714# ' @export
@@ -13,11 +20,22 @@ get_fp_colours <- function(keys) {
1320 # Apply get_fp_colour to each element in the vector
1421 sapply(keys , get_fp_colour , USE.NAMES = FALSE )
1522}
23+ # ' @rdname get_fp_colours
24+ # ' @examples get_fp_colors("rl_green")
25+ # ' @export
26+ get_fp_colors <- get_fp_colours
1627
17- # ' FlatPlot Colour Selection (Single Color)
28+ # ' FlatPlot Colour Selection (Single Colour)
29+ # '
30+ # ' This function takes a single character name/code and returns the
31+ # ' corresponding hex colour. It checks if the input is a valid hex colour code
32+ # ' or a valid R color name, and if not, it uses a predefined mapping for
33+ # ' specific color names like "rl_green", "rl_red", etc. If the input is not
34+ # ' valid, it will return NULL. Use of `get_fp_color` is valid too.
1835# '
1936# ' @param key character name, can be "rl_green", "rl_red", "rl_blue",
20- # ' "rl_yellow", "rl_purple", "rl_orange", "rl_magenta", or a hex colour
37+ # ' "rl_yellow", "rl_purple", "rl_orange", "rl_magenta", "rl_inv", or a hex
38+ # ' colour, or a valid R color name
2139# '
2240# ' @return character of hex colour
2341# ' @importFrom grDevices colors
@@ -44,6 +62,11 @@ get_fp_colour <- function(key) {
4462 " rl_yellow" = " #ffc620" ,
4563 " rl_purple" = " #64318e" ,
4664 " rl_orange" = " #f59331" ,
47- " rl_magenta" = " #da70d6" )
65+ " rl_magenta" = " #da70d6" ,
66+ " rl_inv" = " #ab66f0" )
4867 return (colour )
4968}
69+ # ' @rdname get_fp_colour
70+ # ' @examples get_fp_color("rl_green")
71+ # ' @export
72+ get_fp_color <- get_fp_colour
0 commit comments