Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color palettes part of package #1

Merged
merged 2 commits into from
Feb 4, 2025
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
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ URL: https://github.com/fhdsl/AnVILplot
BugReports: https://github.com/fhdsl/AnVILplot/issues
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Depends:
palettes
palettes,
R (>= 2.10)
LazyData: true
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Generated by roxygen2: do not edit by hand

import(palettes)
7 changes: 5 additions & 2 deletions R/AnVILplot-package.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#' @keywords internal
"_PACKAGE"

## usethis namespace: start
## usethis namespace: end
#' Internal palettes methods
#'
#' @import palettes
#' @keywords internal
#' @name anvil-palette
NULL
73 changes: 73 additions & 0 deletions R/anvil_palette.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#' The Analysis Visualization and Informatics Lab-space (AnVIL) Palettes
#'
#' Palettes inspired by the official colors of the AnVIL

#' @format ## `anvil_palettes`
#' An object of class `palettes_palette` with `r length("anvil_palettes")`
#' colour palettes. Use `names("anvil_palettes")` to return all palette names.
#' @source <https://github.com/fhdsl/AnVILplot>
#' @author [Kate Isaac](https://github.com/kweav)
#' @seealso [pal_palette()], [pal_colour()]
#' @examples
#' # Get all palettes by name.
#' names(anvil_palettes)
#'
#' # Plot all palettes.
#' plot(anvil_palettes)
"anvil_palettes"

#' @rdname anvil_palettes
#' @format ## `anvil_palette_discrete`
#' An object of class `palettes_palette` with
#' `r length(anvil_palette_discrete)` discrete colour palettes.
#' Use `names(anvil_palette_discrete)` to return all palette names.
"anvil_palette_discrete"

#' @rdname anvil_palettes
#' @format ## `anvil_palette_sequential`
#' An object of class `palettes_palette` with
#' `r length(anvil_palette_sequential)` sequential colour palettes.
#' Use `names(anvil_palette_sequential)` to return all palette names.
"anvil_palette_sequential"

#' @rdname anvil_palettes
#' @format ## `anvil_palette_sequential_blues`
#' An object of class `palettes_palette` with
#' `r length(anvil_palette_sequential_blues)` sequential colour palettes.
#' Use `names(anvil_palette_sequential_blues)` to return all palette names.
"anvil_palette_sequential_blues"

#' @rdname anvil_palettes
#' @format ## `anvil_palette_diverging`
#' An object of class `palettes_palette` with
#' `r length(anvil_palette_diverging)` diverging colour palettes.
#' Use `names(anvil_palette_diverging)` to return all palette names.
"anvil_palette_diverging"

#' @rdname anvil_palettes
#' @format ## `anvil_palette_full`
#' An object of class `palettes_palette` with
#' `r length(anvil_palette_full)` colour palettes.
#' Use `names(anvil_palette_full)` to return all palette names.
"anvil_palette_full"

#' @rdname anvil_palettes
#' @format ## `anvil_palette_contrast2`
#' An object of class `palettes_palette` with
#' `r length(anvil_palette_contrast2)` contrasting colour palettes.
#' Use `names(anvil_palette_contrast2)` to return all palette names.
"anvil_palette_contrast2"

#' @rdname anvil_palettes
#' @format ## `anvil_palette_complement2`
#' An object of class `palettes_palette` with
#' `r length(anvil_palette_complement2)`complementing colour palettes.
#' Use `names(anvil_palette_complement2)` to return all palette names.
"anvil_palette_complement2"

#' @rdname anvil_palettes
#' @format ## `anvil_palette_single`
#' An object of class `palettes_palette` with
#' `r length(anvil_palette_single)` colour palettes.
#' Use `names(anvil_palette_single)` to return all palette names.
"anvil_palette_single"
Empty file removed R/palettes.R
Empty file.
87 changes: 69 additions & 18 deletions data-raw/anvil_palette.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

library(palettes)


#' A light and dark discrete palette for AnVIL
#'
#' This color palette is a discrete color palette with
#' 4 dark colors and 4 light colors, all from the
#' [AnVIL style guide](https://anvilproject.org/guides/style/color-palette).
#' These are created manually.
#'
#' @import palettes

anvil_palette_discrete <- pal_palette(
light = c("#F2F2F2", "#E0DD10", "#AEEBF2", "#7EBAC0"),
dark = c("#035C94","#012840", "#25445A", "#333333")
Expand All @@ -28,8 +26,7 @@ usethis::use_data(anvil_palette_discrete, overwrite = TRUE)
#' These are programmatically defined and the base colors used
#' to make the color ramps are from the
#' [AnVIL style guide](https://anvilproject.org/guides/style/color-palette).
#'
#' @import palettes

anvil_palette_sequential <- pal_palette(
blue = pal_ramp(pal_colour(c("#035C94", "#012840")), n = 7),
lightgreen = pal_ramp(pal_colour(c("#F2F2F2", "#7EBAC0")), n =7),
Expand All @@ -40,6 +37,21 @@ plot(anvil_palette_sequential)

usethis::use_data(anvil_palette_sequential, overwrite = TRUE)

#' A sequential blue palette for AnVIL
#'
#' This color palette is a sequential color palette with
#' just blues, using base colors from the
#' [AnVIL style guide](https://anvilproject.org/guides/style/color-palette).


anvil_palette_sequential_blues <- pal_palette(
c("#035C94","#035385","#024A77","#024168", "#02395B")
)

plot(anvil_palette_sequential_blues)

usethis::use_data(anvil_palette_sequential_blues, overwrite = TRUE)

#' A diverging color palette for AnVIL
#'
#' This color palette is a diverging color palette with
Expand All @@ -48,8 +60,7 @@ usethis::use_data(anvil_palette_sequential, overwrite = TRUE)
#' These are programmatically defined and the base colors used
#' to make the color ramps are from the
#' [AnVIL style guide](https://anvilproject.org/guides/style/color-palette).
#'
#' @import palettes


anvil_palette_diverging <- pal_palette(
c(pal_ramp(pal_colour(c("#012840","#035C94")), n = 7), #make 7 colors from dark blue to primary AnVIL blue
Expand All @@ -63,30 +74,70 @@ plot(anvil_palette_diverging)

usethis::use_data(anvil_palette_diverging, overwrite = TRUE)


#' Full palette for AnVIL
#'
#' This color palette lists all of the colors from the
#' [AnVIL style guide](https://anvilproject.org/guides/style/color-palette).
#'
#' @import palettes
anvil_palette <- pal_palette(
anvil_colors = c("#035C94", "#012840", "#F6F7F4", "#F2F2F2", "#E0DD10", "#AEEBF2", "#7EBAC0", "#25445A", "#333333")

anvil_palette_full <- pal_palette(
c("#035C94", "#012840", "#F6F7F4", "#F2F2F2", "#E0DD10", "#AEEBF2", "#7EBAC0", "#25445A", "#333333")
)

plot(anvil_palette)
plot(anvil_palette_full)

usethis::use_data(anvil_palette, overwrite = TRUE)
usethis::use_data(anvil_palette_full, overwrite = TRUE)

#' Qualitative Binary palette for AnVIL
#'
#' This color palette takes two contrasting colors from the
#' [AnVIL style guide](https://anvilproject.org/guides/style/color-palette) and uses them as the color palette.
#'
#' @import palettes
anvil_palette_set2 <- pal_palette(

anvil_palette_contrast2 <- pal_palette(
c("#035C94", "#E0DD10")
)

plot(anvil_palette_set2)
plot(anvil_palette_contrast2)

usethis::use_data(anvil_palette_contrast2, overwrite = TRUE)

#' Qualitative secondary binary palette for AnVIL
#'
#' This color palete takes two complementary colors from the
#' [AnVIL style guide](https://anvilproject.org/guides/style/color-palette) and uses them as the color palette.

anvil_palette_complement2 <- pal_palette(
c("#25445A", "#7EBAC0")
)

plot(anvil_palette_complement2)

usethis::use_data(anvil_palette_complement2, overwrite = TRUE)

#' Single AnVIL color
#'
#' This is a single color from the
#' [AnVIL style guide](https://anvilproject.org/guides/style/color-palette) and uses them as the color palette.

anvil_palette_single <- pal_palette(
c("#25445A")
)

plot(anvil_palette_single)

usethis::use_data(anvil_palette_single, overwrite = TRUE)


# All palettes
anvil_palettes <- c(
anvil_palette_discrete,
anvil_palette_sequential,
anvil_palette_sequential_blues,
anvil_palette_diverging,
anvil_palette_full,
anvil_palette_contrast2,
anvil_palette_complement2,
anvil_palette_single
)

usethis::use_data(anvil_palette_set2, overwrite = TRUE)
usethis::use_data(anvil_palettes, overwrite = TRUE)
Binary file added data/anvil_palette_complement2.rda
Binary file not shown.
Binary file added data/anvil_palette_contrast2.rda
Binary file not shown.
Binary file added data/anvil_palette_discrete.rda
Binary file not shown.
Binary file added data/anvil_palette_diverging.rda
Binary file not shown.
Binary file added data/anvil_palette_full.rda
Binary file not shown.
Binary file added data/anvil_palette_sequential.rda
Binary file not shown.
Binary file added data/anvil_palette_sequential_blues.rda
Binary file not shown.
Binary file added data/anvil_palette_single.rda
Binary file not shown.
Binary file added data/anvil_palettes.rda
Binary file not shown.
116 changes: 116 additions & 0 deletions man/anvil_palettes.Rd

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