Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhodge931 committed Dec 2, 2024
1 parent 89059b0 commit 3ce9c5b
Show file tree
Hide file tree
Showing 7 changed files with 636 additions and 772 deletions.
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

export("%>%")
export(aes_colour_contrast)
export(aes_colour_darken)
export(aes_colour_lighten)
export(aes_fill_darken)
export(aes_fill_lighten)
export(blue)
export(dark_mode_b)
export(dark_mode_r)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Changed `gg_smooth` and `gg_ribbon` default to NA.
* Added colour blending (e.g. `blend = "multiply`).
* Added `gg_lineribbon`.
* Deprecated `aes_colour_darken`, `aes_colour_lighten`, `aes_fill_darken` and `aes_colour_lighten`.

# ggblanket 11.0.0

Expand Down
66 changes: 0 additions & 66 deletions R/aes.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,69 +86,3 @@ aes_colour_contrast <- function(..., dark = "#121B24FF", light = "#FFFFFFFF") {
)
)
}

#' Lighten/darken a colour/fill aesthetic
#'
#' @description
#' Lighten/darken a colour/fill aesthetic based on a
#' * `aes_colour_darken()` Darken a colour aesthetic, relative to a fill aesthetic
#' * `aes_colour_lighten()` Lighten a colour aesthetic, relative to the fill aesthetic
#' * `aes_fill_darken()` Darken a fill aesthetic, relative to a colour aesthetic
#' * `aes_fill_lighten()` Lighten a fill aesthetic, relative to the colour aesthetic
#' Can be spliced into [ggplot2::aes] with [rlang::!!!].
#'
#' @param amount Numeric specifying the amount of lightening or darkening.
#' @param ... Other arguments passed to [colorspace::darken()]/[colorspace::lighten()].
#'
#' @return A ggplot2 aesthetic
#' @export
#'
#' @examples
#' library(ggblanket)
#' library(ggplot2)
#' library(palmerpenguins)
#'
#' set_blanket()
#'
#' penguins |>
#' gg_bar(
#' y = species,
#' col = island,
#' mapping = aes_colour_darken(amount = 0.2),
#' width = 0.75,
#' linewidth = 0.66,
#' )
#'
#' penguins |>
#' gg_bar(
#' y = species,
#' col = island,
#' mapping = aes(!!!aes_colour_darken(amount = 0.2)),
#' width = 0.75,
#' linewidth = 0.66,
#' )
#'
aes_colour_darken <- function(..., amount = 0.1) {
ggplot2::aes(colour = ggplot2::after_scale(colorspace::darken(.data$fill, amount = amount, ...)))
}

#' @rdname aes_colour_darken
#' @export
#'
aes_colour_lighten <- function(..., amount = 0.1) {
ggplot2::aes(colour = ggplot2::after_scale(colorspace::lighten(.data$fill, amount = amount, ...)))
}

#' @rdname aes_colour_darken
#' @export
#'
aes_fill_darken <- function(..., amount = 0.1) {
ggplot2::aes(fill = ggplot2::after_scale(colorspace::darken(.data$colour, amount = amount, ...)))
}

#' @rdname aes_colour_darken
#' @export
#'
aes_fill_lighten <- function(..., amount = 0.1) {
ggplot2::aes(fill = ggplot2::after_scale(colorspace::lighten(.data$colour, amount = amount, ...)))
}
8 changes: 1 addition & 7 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ reference:
- dark_mode_r
- dark_mode_t
- dark_mode_b
- title: Aesthetics
- contents:
- aes_colour_contrast
- aes_colour_darken
- aes_colour_lighten
- aes_fill_darken
- aes_fill_lighten
- title: Sub-setup
- contents:
- weave_mode
Expand All @@ -49,4 +42,5 @@ reference:
- linewidthness
- mode_orientation_to_x
- mode_orientation_to_y
- aes_colour_contrast
- label_every_nth
61 changes: 0 additions & 61 deletions man/aes_colour_darken.Rd

This file was deleted.

Loading

0 comments on commit 3ce9c5b

Please sign in to comment.