-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e72e27d
commit aaa8722
Showing
21 changed files
with
470 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
^popthemes\.Rproj$ | ||
^\.Rproj\.user$ | ||
^LICENSE\.md$ | ||
|
||
^codecov\.yml$ | ||
^docs$ | ||
^_pkgdown\.yml$ | ||
^data-raw$ | ||
^\.travis\.yml$ | ||
^popthemes\.Rproj$ | ||
^\.Rproj\.user$ | ||
^README\.Rmd$ | ||
^README-.*\.png$ | ||
^pkgdown$ | ||
pkgdown/ | ||
|
||
^cran-comments\.md$ | ||
^\.github$ | ||
|
||
|
||
^_pkgdown\.yml$ | ||
^docs$ | ||
^data-raw$ | ||
netlify.toml | ||
pkgdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(pop_palette) | ||
export(print_pal) | ||
importFrom(grDevices,rgb) | ||
importFrom(graphics,image) | ||
importFrom(graphics,par) | ||
importFrom(graphics,rect) | ||
importFrom(graphics,text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
pop_palettes <- list( | ||
aqua = c("#B46843", "#C0AB45", "#5F8841", "#32956F", "#31A6B3", | ||
"#1EA8CF", "#2A638E", "#834583", "#BB3855"), | ||
bangles = c("#6D3A34", "#825137", "#A47850", "#AD9E70", "#9DA49D", | ||
"#7C708E", "#7E5876", "#7C5366", "#5F383F"), | ||
beck = c("#8A4736", "#C1CE7D", "#87E04D", "#92DD8E", | ||
"#9BC3D7", "#A67FC3", "#B03387", "#BA2874","#A53252"), | ||
boo = c("#B04D49", "#C06A51", "#C89B68", "#A79F62" ,"#4D6D7B", | ||
"#42496C", "#633D5A", "#934B63", "#A34351"), | ||
# boo2 = c("#97807D", "#B69789", "C7B3A2", "#CEC9B6", "#98B9B7", | ||
# "#6A97A6", "#6F7C89", "#544E58", "#A95E71"), | ||
breeders = c("#792F28", "#763F25", "#856426", "#818425", "#799821", | ||
"#3C7135", "#5F253B", "#89172A", "#93242A"), | ||
bwitched = c("#B1473C", "#BB553E", "#C65B3F", "#C86141", "#D26D48", | ||
"#CB7749", "#9C8F49", "#374E5D", "#5F2A60"), | ||
deeelite = c("#BB923A", "#8DB23C", "#83C044", "#518755" ,"#324976", | ||
"#3F3788", "#4B3181", "#8C3684", "#E1577D"), | ||
hole = c("#67332C" ,"#904B32", "#A3663E", "#B98855", "#C9A466", | ||
"#D4BB6F", "#738664", "#5C4966", "#6D4254"), | ||
nodoubt = c("#B27058", "#BB915D", "#BAAD73", "#A4B988", "#73AFA0", | ||
"#65ADBC", "#446F96", "#344681", "#874F8B"), | ||
sclub7 = c("#945644","#C59F6F", "#9E8F64", "#5D6B58", "#496569", | ||
"#50768C", "#6288A6", "#7589A4", "#834370"), | ||
spice = c("#C39384", "#DAC191", "#E8DE97", "#DDE4A2", "#B5D8C6", | ||
"#ABCEDF", "#BBC2E1", "#E0BFDF", "#CC798C"), | ||
steps = c("#A65A57", "#D18C7E", "#F2BEA3", "#E5DFBD", "#85BACB", | ||
"#8895C4", "#BB6CA6", "#BA638C", "#9B535A") | ||
) | ||
|
||
|
||
#' Color Palettes based on 90s pop album covers | ||
#' | ||
#' R package that contains color palettes based on 90s pop album covers. | ||
#' | ||
#' | ||
#' See also: https://github.com/johnmackintosh/metallicaRt for metallica palettes | ||
#' | ||
#' and https://github.com/johnmackintosh/rockthemes for rock palettes | ||
#' | ||
#' @param name Name of palette. Select one: | ||
#' \code{aqua}, \code{bangles}, \code{beck}, \code{boo}, | ||
#' \code{breeders}, \code{bwitched}, \code{deeelite},\code{hole}, | ||
#' \code{nodoubt}, \code{sclub7}, \code{spice},\code{steps} | ||
#' | ||
#' | ||
#' @param n Number of colors desired. | ||
#' | ||
#' Some palettes contain 5 colors. Those beginning with 'rock' have 4 | ||
#' | ||
#' @param type Either continuous or discrete. | ||
#' | ||
#' @return A vector of colors. | ||
#' @export | ||
#' | ||
#' @examples | ||
#' pop_palette("aqua") | ||
#' | ||
pop_palette <- function(name, n, type = c("discrete", "continuous")) { | ||
type <- match.arg(type) | ||
|
||
pal <- pop_palettes[[name]] | ||
if (is.null(pal)) | ||
stop("Palette not found") | ||
|
||
if (missing(n)) { | ||
n = length(pal) | ||
} | ||
|
||
if (type == "discrete" && n > length(pal)) { | ||
stop(paste("You have requested", n, "colors, but this palette only contains", length(pal), "colors.")) | ||
} | ||
|
||
out <- switch(type, | ||
continuous = grDevices::colorRampPalette(pal)(n), | ||
discrete = pal[1:n] | ||
) | ||
structure(out, class = "palette", name = name) | ||
} | ||
|
||
#' @export | ||
#' @importFrom graphics rect par image text | ||
#' @importFrom grDevices rgb | ||
print_pal <- function(x, ...) { | ||
n <- length(x) | ||
old <- par(mar = c(0.5, 0.5, 0.5, 0.5)) | ||
on.exit(par(old)) | ||
|
||
image(1:n, 1, as.matrix(1:n), col = x, | ||
ylab = "", xaxt = "n", yaxt = "n", bty = "n") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#' print_pal | ||
|
||
#' @param x palette name | ||
#' | ||
#' @param ... additional arguments | ||
#' | ||
#' @export | ||
#' @importFrom graphics rect par image text | ||
#' @importFrom grDevices rgb | ||
#' | ||
#' @examples | ||
#' print_pal('aqua') | ||
#' | ||
#' | ||
print_pal <- function(x, ...) { | ||
n <- length(x) | ||
old <- par(mar = c(0.5, 0.5, 0.5, 0.5)) | ||
on.exit(par(old)) | ||
|
||
image(1:n, 1, as.matrix(1:n), col = x, | ||
ylab = "", xaxt = "n", yaxt = "n", bty = "n") | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
popthemes | ||
================ | ||
|
||
<!-- badges: start --> | ||
<!-- badges: end --> | ||
|
||
## What? | ||
|
||
This is a collection of colour palettes based on 90s pop album covers. | ||
|
||
Some of these appeared frequently in web searches, so they must be good. | ||
|
||
Featuring: | ||
|
||
- Aqua | ||
- Bangles | ||
- Beck | ||
- Betty Boo | ||
- Breeders | ||
- B\*Witched | ||
- Deee Lite | ||
- Hole | ||
- No Doubt | ||
- S Club 7 | ||
- Spice Girls | ||
- Steps | ||
|
||
## Why? | ||
|
||
Because[I’ve done | ||
Metallica](https://github.com/johnmackintosh/metallicaRt) and [classic | ||
rock](https://github.com/johnmackintosh/rockthemes). | ||
|
||
Although rockthemes has some pop acts in it as well, including No Doubt | ||
and DeeeLite, who also appear here. Don’t worry about it. | ||
|
||
## Installation | ||
|
||
This will probably not go to CRAN, so please install using the remotes | ||
package. | ||
|
||
``` r | ||
#library(remotes) | ||
#remotes::install_github("johnmackintosh/popthemes") | ||
library(popthemes) | ||
``` | ||
|
||
# Palettes and Themes | ||
|
||
``` r | ||
pop_palette("aqua") | ||
#> [1] "#B46843" "#C0AB45" "#5F8841" "#32956F" "#31A6B3" "#1EA8CF" "#2A638E" | ||
#> [8] "#834583" "#BB3855" | ||
#> attr(,"class") | ||
#> [1] "palette" | ||
#> attr(,"name") | ||
#> [1] "aqua" | ||
pop_palette("bangles") | ||
#> [1] "#6D3A34" "#825137" "#A47850" "#AD9E70" "#9DA49D" "#7C708E" "#7E5876" | ||
#> [8] "#7C5366" "#5F383F" | ||
#> attr(,"class") | ||
#> [1] "palette" | ||
#> attr(,"name") | ||
#> [1] "bangles" | ||
pop_palette("beck") | ||
#> [1] "#8A4736" "#C1CE7D" "#87E04D" "#92DD8E" "#9BC3D7" "#A67FC3" "#B03387" | ||
#> [8] "#BA2874" "#A53252" | ||
#> attr(,"class") | ||
#> [1] "palette" | ||
#> attr(,"name") | ||
#> [1] "beck" | ||
``` | ||
|
||
``` r | ||
pop_palette("boo") | ||
#> [1] "#B04D49" "#C06A51" "#C89B68" "#A79F62" "#4D6D7B" "#42496C" "#633D5A" | ||
#> [8] "#934B63" "#A34351" | ||
#> attr(,"class") | ||
#> [1] "palette" | ||
#> attr(,"name") | ||
#> [1] "boo" | ||
pop_palette("breeders") | ||
#> [1] "#792F28" "#763F25" "#856426" "#818425" "#799821" "#3C7135" "#5F253B" | ||
#> [8] "#89172A" "#93242A" | ||
#> attr(,"class") | ||
#> [1] "palette" | ||
#> attr(,"name") | ||
#> [1] "breeders" | ||
pop_palette("bwitched") | ||
#> [1] "#B1473C" "#BB553E" "#C65B3F" "#C86141" "#D26D48" "#CB7749" "#9C8F49" | ||
#> [8] "#374E5D" "#5F2A60" | ||
#> attr(,"class") | ||
#> [1] "palette" | ||
#> attr(,"name") | ||
#> [1] "bwitched" | ||
``` | ||
|
||
``` r | ||
pop_palette("deeelite") | ||
#> [1] "#BB923A" "#8DB23C" "#83C044" "#518755" "#324976" "#3F3788" "#4B3181" | ||
#> [8] "#8C3684" "#E1577D" | ||
#> attr(,"class") | ||
#> [1] "palette" | ||
#> attr(,"name") | ||
#> [1] "deeelite" | ||
pop_palette("hole") | ||
#> [1] "#67332C" "#904B32" "#A3663E" "#B98855" "#C9A466" "#D4BB6F" "#738664" | ||
#> [8] "#5C4966" "#6D4254" | ||
#> attr(,"class") | ||
#> [1] "palette" | ||
#> attr(,"name") | ||
#> [1] "hole" | ||
pop_palette("nodoubt") | ||
#> [1] "#B27058" "#BB915D" "#BAAD73" "#A4B988" "#73AFA0" "#65ADBC" "#446F96" | ||
#> [8] "#344681" "#874F8B" | ||
#> attr(,"class") | ||
#> [1] "palette" | ||
#> attr(,"name") | ||
#> [1] "nodoubt" | ||
``` | ||
|
||
``` r | ||
pop_palette("sclub7") | ||
#> [1] "#945644" "#C59F6F" "#9E8F64" "#5D6B58" "#496569" "#50768C" "#6288A6" | ||
#> [8] "#7589A4" "#834370" | ||
#> attr(,"class") | ||
#> [1] "palette" | ||
#> attr(,"name") | ||
#> [1] "sclub7" | ||
pop_palette("spice") | ||
#> [1] "#C39384" "#DAC191" "#E8DE97" "#DDE4A2" "#B5D8C6" "#ABCEDF" "#BBC2E1" | ||
#> [8] "#E0BFDF" "#CC798C" | ||
#> attr(,"class") | ||
#> [1] "palette" | ||
#> attr(,"name") | ||
#> [1] "spice" | ||
pop_palette("steps") | ||
#> [1] "#A65A57" "#D18C7E" "#F2BEA3" "#E5DFBD" "#85BACB" "#8895C4" "#BB6CA6" | ||
#> [8] "#BA638C" "#9B535A" | ||
#> attr(,"class") | ||
#> [1] "palette" | ||
#> attr(,"name") | ||
#> [1] "steps" | ||
``` | ||
|
||
## Credit | ||
|
||
[Thanks to Ryo for the tvthemes | ||
package](https://github.com/Ryo-N7/tvthemes) which helped me get this | ||
off the ground quickly | ||
|
||
## Code of Conduct | ||
|
||
Please note that the popthemes project is released with a [Contributor | ||
Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project | ||
you agree to abide by its terms. | ||
|
||
## Contributing | ||
|
||
See the [Contribution guide](.github/CONTRIBUTING.md) |
Oops, something went wrong.