Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhodge931 committed Jul 7, 2024
1 parent 0486c14 commit 4f56371
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion R/set_blanket.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' @param col_palette_na_d For a discrete scale, a hex code.
#' @param col_palette_na_c For a continuous scale, a hex code.
#' @param col_palette_na_o For an ordinal scale, a hex code.
#' @param theme A ggplot2 theme that the `gg_*` function will add without side-effects. Note, `mode` takes precedence, unless `mode = NULL`.
#' @param theme A ggplot2 theme that the `gg_*` function will add without side-effects. Note, the `mode` takes precedence, unless `mode = NULL`.
#'
#' @return A globally set style.
#' @export
Expand Down
17 changes: 11 additions & 6 deletions R/weave.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,22 @@ weave_mode <- function(mode = light_mode_r()) {

#' Set a theme (without side-effects)
#'
#' @description Set a theme to be `+`-ed on unmodified to `gg_*` functions. Note, `mode` takes precedence unless NULL.
#' @description Set a theme to be `+`-ed on unmodified to `gg_*` functions. Note, the `mode` takes precedence, unless `mode = NULL`.
#'
#' @param theme A ggplot2 theme that the `gg_*` function will add without side-effects. Note, `mode` takes precedence, unless `mode = NULL`.
#' @param theme A ggplot2 theme that the `gg_*` function will add without side-effects. Use NULL for ggplot2 default.
#'
#' @export
weave_theme <- function(theme = light_mode_r() + mode_orientation_to_x()) {
old <- ggblanket_global$theme
ggblanket_global$theme <- theme
invisible(old)

ggplot2::theme_set(new = theme)
if (rlang::is_null(theme)) {
ggplot2::theme_set(new = ggplot2::theme_grey())
}
else {
ggplot2::theme_set(new = theme)
}
}

#' Set a series of geom defaults
Expand Down Expand Up @@ -102,7 +107,7 @@ weave_geom_defaults <- function(colour = "#357BA2FF",

#' Set a discrete colour palette
#'
#' @param col_palette_d For a discrete scale, a character vector of hex codes.
#' @param col_palette_d For a discrete scale, a character vector of hex codes. Use NULL for ggplot2 default.
#' @param col_palette_d_na For a discrete scale, a hex code.
#' @param ... Dots to support trailing commas etc.
#'
Expand Down Expand Up @@ -153,7 +158,7 @@ weave_col_palette_d <- function(col_palette_d = jumble, col_palette_d_na = "#CDC

#' Set a continuous colour palette
#'
#' @param col_palette_c For a continuous scale, a character vector of hex codes.
#' @param col_palette_c For a continuous scale, a character vector of hex codes. Use NULL for ggplot2 default.
#' @param col_palette_c_na For a continuous scale, a hex code.
#' @param ... Dots to support trailing commas etc.
#'
Expand Down Expand Up @@ -196,7 +201,7 @@ weave_col_palette_c <- function(col_palette_c = viridisLite::mako(n = 9, directi

#' Set an ordinal colour palette
#'
#' @param col_palette_o For an ordinal scale, a `scales::pal_*()` function.
#' @param col_palette_o For an ordinal scale, a `scales::pal_*()` function. Use NULL for ggplot2 default.
#' @param col_palette_o_na For an ordinal scale, a hex code.
#'
#' @export
Expand Down
2 changes: 1 addition & 1 deletion man/set_blanket.Rd

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

2 changes: 1 addition & 1 deletion man/weave_col_palette_c.Rd

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

2 changes: 1 addition & 1 deletion man/weave_col_palette_d.Rd

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

2 changes: 1 addition & 1 deletion man/weave_col_palette_o.Rd

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

4 changes: 2 additions & 2 deletions man/weave_theme.Rd

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

0 comments on commit 4f56371

Please sign in to comment.