Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions R/discrete-primer.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' The Primer design system data visualization palette.
#'
#' @param palette Palette type.
#' Currently there is one available option: `"default"`
#' Currently there is one available option: `"mark17"`
#' (17-color palette).
#' @param alpha Transparency level, a real number in (0, 1].
#' See `alpha` in [grDevices::rgb()] for details.
Expand All @@ -21,9 +21,9 @@
#'
#' @examples
#' library("scales")
#' show_col(pal_primer("default")(17))
#' show_col(pal_primer("default", alpha = 0.6)(17))
pal_primer <- function(palette = c("default"), alpha = 1) {
#' show_col(pal_primer("mark17")(17))
#' show_col(pal_primer("mark17", alpha = 0.6)(17))
pal_primer <- function(palette = c("mark17"), alpha = 1) {
palette <- match.arg(palette)

if (alpha > 1L || alpha <= 0L) stop("alpha must be in (0, 1]")
Expand Down Expand Up @@ -61,7 +61,7 @@ pal_primer <- function(palette = c("default"), alpha = 1) {
#' @examples
#' example_scatterplot() + scale_color_primer()
#' example_barplot() + scale_fill_primer()
scale_color_primer <- function(palette = c("default"), alpha = 1, ...) {
scale_color_primer <- function(palette = c("mark17"), alpha = 1, ...) {
palette <- match.arg(palette)
if (is_ggplot2_350()) {
discrete_scale("colour", palette = pal_primer(palette, alpha), ...)
Expand All @@ -77,7 +77,7 @@ scale_colour_primer <- scale_color_primer
#' @export scale_fill_primer
#' @importFrom ggplot2 discrete_scale
#' @rdname scale_primer
scale_fill_primer <- function(palette = c("default"), alpha = 1, ...) {
scale_fill_primer <- function(palette = c("mark17"), alpha = 1, ...) {
palette <- match.arg(palette)
if (is_ggplot2_350()) {
discrete_scale("fill", palette = pal_primer(palette, alpha), ...)
Expand Down
2 changes: 1 addition & 1 deletion R/palettes.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ ggsci_db$"observable"$"observable10" <- c(
)

# Primer data visualization color palette ----
ggsci_db$"primer"$"default" <- c(
ggsci_db$"primer"$"mark17" <- c(
"Blue" = "#006EDB",
"Orange" = "#EB670F",
"Red" = "#DF0C24",
Expand Down
8 changes: 4 additions & 4 deletions man/pal_primer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/scale_primer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/ggsci.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ summarized in the table below.
| Observable | `scale_color_observable()` | `"observable10"` | `pal_observable()` |
| | `scale_fill_observable()` | | |
+-----------------+------------------------------+--------------------------------+----------------------+
| Primer | `scale_color_primer()` | `"default"` | `pal_primer()` |
| Primer | `scale_color_primer()` | `"mark17"` | `pal_primer()` |
| | `scale_fill_primer()` | | |
+-----------------+------------------------------+--------------------------------+----------------------+
| LocusZoom | `scale_color_locuszoom()` | `"default"` | `pal_locuszoom()` |
Expand Down
Loading