No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
b6a7019
... +0 ...
eecd15e
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
106 | 106 | num_recodings <- length(cut_points) - 1 |
|
107 | 107 | } |
|
108 | 108 | ||
109 | - | # If the number of recodings lower than any Color |
|
110 | - | # Brewer palette, shift palette to `viridis` |
|
111 | - | if ((num_recodings < 3 | num_recodings > 10) & palette %in% |
|
112 | - | c(row.names(RColorBrewer::brewer.pal.info))) { |
|
113 | - | palette <- "viridis" |
|
109 | + | # Handle vector of hexadecimal or named colors |
|
110 | + | if (length(palette) > 1) { |
|
111 | + | # Verify colors are valid |
|
112 | + | if (!all(tolower(palette) %in% x11_hex()$hex)) { |
|
113 | + | emit_error(fcn_name = fcn_name, |
|
114 | + | reasons = "The color palette contains invalid hexadecimal values.") |
|
115 | + | } |
|
116 | + | if (length(palette) < num_recodings) { |
|
117 | + | # Revert to viridis if provided color vector is too short |
|
118 | + | palette <- "viridis" |
|
119 | + | } else { |
|
120 | + | color_palette <- toupper(palette)[1:num_recodings] |
|
121 | + | } |
|
114 | 122 | } |
|
115 | 123 | ||
116 | - | # Stop function if color palette is not `viridis` |
|
117 | - | # or any of the RColorBrewer palettes |
|
124 | + | # Handle viridis and ColorBrewer palette name input |
|
118 | 125 | if (length(palette) == 1) { |
|
119 | - | if (!(palette %in% |
|
120 | - | c(row.names(RColorBrewer::brewer.pal.info), |
|
121 | - | "viridis"))) { |
|
126 | + | # If the number of recodings lower than any Color |
|
127 | + | # Brewer palette, shift palette to `viridis` |
|
128 | + | if ((num_recodings < 3 | num_recodings > 10) & palette %in% |
|
129 | + | c(row.names(RColorBrewer::brewer.pal.info))) { |
|
130 | + | palette <- "viridis" |
|
131 | + | } |
|
122 | 132 | ||
133 | + | # or any of the RColorBrewer palettes |
|
134 | + | if (!(palette %in% c(row.names(RColorBrewer::brewer.pal.info), |
|
135 | + | "viridis"))) { |
|
123 | 136 | emit_error( |
|
124 | 137 | fcn_name = fcn_name, |
|
125 | 138 | reasons = "The color palette is not an `RColorBrewer` or `viridis` palette") |
|
126 | 139 | } |
|
127 | - | } |
|
128 | 140 | ||
129 | - | # Obtain a color palette |
|
130 | - | if (length(palette) == 1) { |
|
131 | - | if (palette %in% |
|
132 | - | row.names(RColorBrewer::brewer.pal.info)) { |
|
141 | + | # Obtain a color palette |
|
142 | + | if (palette %in% row.names(RColorBrewer::brewer.pal.info)) { |
|
133 | 143 | color_palette <- RColorBrewer::brewer.pal(num_recodings, palette) |
|
134 | 144 | } else if (palette == "viridis") { |
|
135 | 145 | color_palette <- viridis::viridis(num_recodings) |
153 | 153 | num_recodings <- length(cut_points) - 1 |
|
154 | 154 | } |
|
155 | 155 | ||
156 | - | # If the number of recodings lower than any Color |
|
157 | - | # Brewer palette, shift palette to `viridis` |
|
158 | - | if ((num_recodings < 3 | num_recodings > 10) & palette %in% |
|
159 | - | c(row.names(RColorBrewer::brewer.pal.info))) { |
|
160 | - | palette <- "viridis" |
|
156 | + | # Handle vector of hexadecimal or named colors |
|
157 | + | if (length(palette) > 1) { |
|
158 | + | # Verify colors are valid |
|
159 | + | if (!all(tolower(palette) %in% x11_hex()$hex)) { |
|
160 | + | emit_error(fcn_name = fcn_name, |
|
161 | + | reasons = "The color palette contains invalid hexadecimal values.") |
|
162 | + | } |
|
163 | + | if (length(palette) < num_recodings) { |
|
164 | + | # Revert to viridis if provided color vector is too short |
|
165 | + | palette <- "viridis" |
|
166 | + | } else { |
|
167 | + | color_palette <- toupper(palette)[1:num_recodings] |
|
168 | + | } |
|
161 | 169 | } |
|
162 | 170 | ||
163 | - | # or any of the RColorBrewer palettes |
|
171 | + | # Handle viridis and ColorBrewer palette name input |
|
164 | 172 | if (length(palette) == 1) { |
|
165 | - | if (!(palette %in% |
|
166 | - | c(row.names(RColorBrewer::brewer.pal.info), |
|
167 | - | "viridis"))) { |
|
173 | + | # If the number of recodings lower than any Color |
|
174 | + | # Brewer palette, shift palette to `viridis` |
|
175 | + | if ((num_recodings < 3 | num_recodings > 10) & palette %in% |
|
176 | + | c(row.names(RColorBrewer::brewer.pal.info))) { |
|
177 | + | palette <- "viridis" |
|
178 | + | } |
|
168 | 179 | ||
180 | + | # or any of the RColorBrewer palettes |
|
181 | + | if (!(palette %in% c(row.names(RColorBrewer::brewer.pal.info), |
|
182 | + | "viridis"))) { |
|
169 | 183 | emit_error( |
|
170 | 184 | fcn_name = fcn_name, |
|
171 | 185 | reasons = "The color palette is not an `RColorBrewer` or `viridis` palette") |
|
172 | 186 | } |
|
173 | - | } |
|
174 | 187 | ||
175 | - | # Obtain a color palette |
|
176 | - | if (length(palette) == 1) { |
|
177 | - | if (palette %in% |
|
178 | - | row.names(RColorBrewer::brewer.pal.info)) { |
|
188 | + | # Obtain a color palette |
|
189 | + | if (palette %in% row.names(RColorBrewer::brewer.pal.info)) { |
|
179 | 190 | color_palette <- RColorBrewer::brewer.pal(num_recodings, palette) |
|
180 | 191 | } else if (palette == "viridis") { |
|
181 | 192 | color_palette <- viridis::viridis(num_recodings) |
eecd15e
b6a7019