├── .Rbuildignore ├── .github ├── .gitignore └── workflows │ ├── R-CMD-check.yaml │ ├── pkgdown.yaml │ └── test-coverage.yaml ├── .gitignore ├── DESCRIPTION ├── LICENSE ├── LICENSE.md ├── NAMESPACE ├── NEWS.md ├── R ├── lisa-package.R ├── lisa.R └── utils.R ├── README.Rmd ├── README.md ├── _pkgdown.yml ├── codecov.yml ├── cran-comments.md ├── data-raw ├── build.R └── build_yaml.R ├── data ├── artwork.rda └── lisa.rda ├── inst └── extdata │ └── palettes.yml ├── lisa.Rproj ├── man ├── artwork.Rd ├── figures │ ├── README-example1-1.png │ ├── README-example2-1.png │ ├── README-example2-2.png │ ├── README-example2-3.png │ ├── README-ggplot2-example-1.png │ ├── README-waffle-1.png │ └── logo.png ├── lisa.Rd └── lisa_palette.Rd ├── pkgdown └── favicon │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-152x152.png │ ├── apple-touch-icon-180x180.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ └── favicon.ico ├── tests ├── testthat.R └── testthat │ ├── test-attributes.R │ ├── test-lisa-data.R │ └── test-lisa_palette.R └── vignettes ├── .gitignore └── lisa-palette.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^codecov\.yml$ 2 | ^CRAN-RELEASE$ 3 | ^cran-comments\.md$ 4 | ^appveyor\.yml$ 5 | ^\.travis\.yml$ 6 | ^LICENSE\.md$ 7 | ^README\.Rmd$ 8 | ^data-raw$ 9 | ^lisa\.Rproj$ 10 | ^\.Rproj\.user$ 11 | ^_pkgdown\.yml$ 12 | ^docs$ 13 | ^pkgdown$ 14 | ^\.github$ 15 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. 2 | # https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | name: R-CMD-check 12 | 13 | jobs: 14 | R-CMD-check: 15 | runs-on: ${{ matrix.config.os }} 16 | 17 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 18 | 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | config: 23 | - {os: windows-latest, r: 'release'} 24 | - {os: macOS-latest, r: 'release'} 25 | - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} 26 | - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} 27 | 28 | env: 29 | R_REMOTES_NO_ERRORS_FROM_WARNINGS: true 30 | RSPM: ${{ matrix.config.rspm }} 31 | 32 | steps: 33 | - uses: actions/checkout@v2 34 | 35 | - uses: r-lib/actions/setup-r@master 36 | with: 37 | r-version: ${{ matrix.config.r }} 38 | 39 | - uses: r-lib/actions/setup-pandoc@master 40 | 41 | - name: Query dependencies 42 | run: | 43 | install.packages('remotes') 44 | saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) 45 | writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") 46 | shell: Rscript {0} 47 | 48 | - name: Cache R packages 49 | if: runner.os != 'Windows' 50 | uses: actions/cache@v1 51 | with: 52 | path: ${{ env.R_LIBS_USER }} 53 | key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} 54 | restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- 55 | 56 | - name: Install system dependencies 57 | if: runner.os == 'Linux' 58 | run: | 59 | while read -r cmd 60 | do 61 | eval sudo $cmd 62 | done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') 63 | 64 | - name: Install dependencies 65 | run: | 66 | remotes::install_deps(dependencies = TRUE) 67 | remotes::install_cran("rcmdcheck") 68 | shell: Rscript {0} 69 | 70 | - name: Check 71 | env: 72 | _R_CHECK_CRAN_INCOMING_REMOTE_: false 73 | run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") 74 | shell: Rscript {0} 75 | 76 | - name: Upload check results 77 | if: failure() 78 | uses: actions/upload-artifact@main 79 | with: 80 | name: ${{ runner.os }}-r${{ matrix.config.r }}-results 81 | path: check 82 | -------------------------------------------------------------------------------- /.github/workflows/pkgdown.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: master 4 | 5 | name: pkgdown 6 | 7 | jobs: 8 | pkgdown: 9 | runs-on: macOS-latest 10 | env: 11 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 12 | steps: 13 | - uses: actions/checkout@v2 14 | 15 | - uses: r-lib/actions/setup-r@master 16 | 17 | - uses: r-lib/actions/setup-pandoc@master 18 | 19 | - name: Query dependencies 20 | run: | 21 | install.packages('remotes') 22 | saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) 23 | writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") 24 | shell: Rscript {0} 25 | 26 | - name: Cache R packages 27 | uses: actions/cache@v1 28 | with: 29 | path: ${{ env.R_LIBS_USER }} 30 | key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} 31 | restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- 32 | 33 | - name: Install dependencies 34 | run: | 35 | remotes::install_deps(dependencies = TRUE) 36 | install.packages("pkgdown") 37 | shell: Rscript {0} 38 | 39 | - name: Install package 40 | run: R CMD INSTALL . 41 | 42 | - name: Deploy package 43 | run: | 44 | git config --local user.email "actions@github.com" 45 | git config --local user.name "GitHub Actions" 46 | Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' 47 | -------------------------------------------------------------------------------- /.github/workflows/test-coverage.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: 4 | - master 5 | pull_request: 6 | branches: 7 | - master 8 | 9 | name: test-coverage 10 | 11 | jobs: 12 | test-coverage: 13 | runs-on: macOS-latest 14 | env: 15 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - uses: r-lib/actions/setup-r@master 20 | 21 | - uses: r-lib/actions/setup-pandoc@master 22 | 23 | - name: Query dependencies 24 | run: | 25 | install.packages('remotes') 26 | saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) 27 | writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") 28 | shell: Rscript {0} 29 | 30 | - name: Cache R packages 31 | uses: actions/cache@v1 32 | with: 33 | path: ${{ env.R_LIBS_USER }} 34 | key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} 35 | restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- 36 | 37 | - name: Install dependencies 38 | run: | 39 | install.packages(c("remotes")) 40 | remotes::install_deps(dependencies = TRUE) 41 | remotes::install_cran("covr") 42 | shell: Rscript {0} 43 | 44 | - name: Test coverage 45 | run: covr::codecov() 46 | shell: Rscript {0} 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rhistory 2 | .RData 3 | .Rproj.user 4 | .DS_Store 5 | inst/doc 6 | docs 7 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: lisa 2 | Title: Color Palettes from Color Lisa 3 | Version: 0.1.2 4 | Authors@R: 5 | person(given = "Tyler", 6 | family = "Littlefield", 7 | role = c("aut", "cre"), 8 | email = "tylerlittlefield@hey.com", 9 | comment = c(ORCID = "0000-0002-6020-1125")) 10 | Description: Contains 128 palettes from Color Lisa. All palettes are based on 11 | masterpieces from the worlds greatest artists. For more information, see 12 | . 13 | Depends: R (>= 2.10) 14 | License: MIT + file LICENSE 15 | Encoding: UTF-8 16 | LazyData: true 17 | RoxygenNote: 7.1.1 18 | URL: https://github.com/tyluRp/lisa 19 | BugReports: https://github.com/tyluRp/lisa/issues 20 | Suggests: 21 | testthat, 22 | covr, 23 | knitr, 24 | rmarkdown 25 | VignetteBuilder: knitr 26 | Imports: 27 | tibble 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2019 2 | COPYRIGHT HOLDER: Tyler Littlefield 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2019 Tyler Littlefield 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(plot,lisa_palette) 4 | S3method(print,lisa_palette) 5 | export(lisa_palette) 6 | importFrom(grDevices,rgb) 7 | importFrom(graphics,image) 8 | importFrom(graphics,par) 9 | importFrom(graphics,rect) 10 | importFrom(graphics,text) 11 | importFrom(tibble,tibble) 12 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # lisa 0.1.2 2 | 3 | * New print method of palettes. 4 | * Updated `artwork` dataset to include colors and url information. 5 | 6 | # lisa 0.1.1 7 | 8 | * `lisa_palette` returns the "work" attribute. 9 | * `lisa_palette` preserves character class. 10 | * Add S3 print method for objects of class `lisa_palette` to avoid printing attributes. 11 | * You can now change the title of palette when using `plot`. 12 | 13 | # lisa 0.1.0 14 | 15 | * Added a `NEWS.md` file to track changes to the package. 16 | -------------------------------------------------------------------------------- /R/lisa-package.R: -------------------------------------------------------------------------------- 1 | ## usethis namespace: start 2 | #' @importFrom tibble tibble 3 | ## usethis namespace: end 4 | NULL 5 | -------------------------------------------------------------------------------- /R/lisa.R: -------------------------------------------------------------------------------- 1 | #' List of all available palettes 2 | #' 3 | #' A list containing all available palettes (128) and their attributes (class, 4 | #' artist name and the name of the artwork). 5 | #' 6 | #' Source: \url{http://colorlisa.com/} 7 | "lisa" 8 | 9 | #' Artist, palettes, and artwork names 10 | #' 11 | #' A table containing various information about each palette. 12 | #' 13 | #' @format A data frame with 128 rows and 3 variables: 14 | #' \describe{ 15 | #' \item{author}{name of artist} 16 | #' \item{work}{name of artwork} 17 | #' \item{palette}{name of the palette} 18 | #' \item{colors}{hex color codes} 19 | #' \item{url}{url for artwork info} 20 | #' } 21 | #' 22 | #' @return a [tibble][tibble::tibble-package] 23 | #' 24 | #' Source: \url{http://colorlisa.com/} 25 | #' @md 26 | "artwork" 27 | 28 | #' Call or modify lisa palettes 29 | #' 30 | #' @param n Number of colors desired. 31 | #' @param name Name of desired palette. See \code{names(lisa)}. 32 | #' @param type Either "continuous" or "discrete". Use continuous if you want 33 | #' to automatically interpolate between colors. 34 | #' 35 | #' @importFrom graphics rect par image text 36 | #' @return A vector of colors. 37 | #' @examples 38 | #' lisa_palette(name = "Prince", n = 10, type = "continuous") 39 | #' lisa_palette("PabloPicasso", 2, "discrete") 40 | #' @export 41 | lisa_palette <- function(name, n, type = c("discrete", "continuous")) { 42 | type <- match.arg(type) 43 | work <- attributes(lisa::lisa[[name]])$work 44 | 45 | pal <- lisa::lisa[[name]] 46 | if (is.null(pal)) 47 | stop("Palette not found.") 48 | 49 | if (missing(n)) { 50 | n <- length(pal) 51 | } 52 | 53 | if (type == "discrete" && n > length(pal)) { 54 | stop("Number of requested colors greater than what palette can offer") 55 | } 56 | 57 | out <- switch(type, 58 | continuous = grDevices::colorRampPalette(pal)(n), 59 | discrete = pal[1:n] 60 | ) 61 | 62 | structure(out, class = c("lisa_palette", class(out)), name = name, work = work) 63 | } 64 | -------------------------------------------------------------------------------- /R/utils.R: -------------------------------------------------------------------------------- 1 | is.lisa_palette <- function(x) { 2 | inherits(x, "lisa_palette") 3 | } 4 | 5 | #' @export 6 | #' @importFrom graphics rect par image text 7 | #' @importFrom grDevices rgb 8 | plot.lisa_palette <- function(x, ...) { 9 | if(is.lisa_palette(x)) { 10 | 11 | if(length(list(...))) { 12 | label = list(...)[[1]] 13 | } else { 14 | label = attr(x, "name") 15 | } 16 | 17 | n <- length(x) 18 | old <- par(mar = c(0.5, 0.5, 0.5, 0.5)) 19 | on.exit(par(old)) 20 | 21 | image(1:n, 1, as.matrix(1:n), col = x, 22 | ylab = "", xaxt = "n", yaxt = "n", bty = "n") 23 | 24 | rect(0, 0.9, n + 1, 1.1, col = rgb(1, 1, 1, 0.8), border = NA) 25 | text((n + 1) / 2, 1, labels = label, cex = 1, family = "mono") 26 | } 27 | } 28 | 29 | #' @export 30 | print.lisa_palette <- function(x, ...) { 31 | if (is.lisa_palette(x)) { 32 | if (length(x) > 5) { 33 | cols <- paste(paste(x[1:5], collapse = " "),"... and", length(x) - 5, "more") 34 | } else { 35 | cols <- x 36 | } 37 | cat("* Work:", attr(x, "work"), "\n") 38 | cat("* Author:", attr(x, "name"), "\n") 39 | cat("* Colors:", cols) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | 6 | 7 | ```{r, include = FALSE} 8 | knitr::opts_chunk$set( 9 | collapse = TRUE, 10 | comment = "#>", 11 | fig.path = "man/figures/README-", 12 | out.width = "100%", 13 | dpi = 300 14 | ) 15 | ``` 16 | # lisa 17 | 18 | 19 | [![R build status](https://github.com/tyluRp/lisa/workflows/R-CMD-check/badge.svg)](https://github.com/tyluRp/lisa/actions) 20 | [![CRAN status](https://www.r-pkg.org/badges/version/lisa)](https://cran.r-project.org/package=lisa) 21 | [![CRAN_Download_Badge](https://cranlogs.r-pkg.org/badges/lisa)](https://cran.r-project.org/package=lisa) 22 | [![Codecov test coverage](https://codecov.io/gh/tyluRp/lisa/branch/master/graph/badge.svg)](https://codecov.io/gh/tyluRp/lisa?branch=master) 23 | 24 | 25 | This is a color palette R package that contains 128 palettes from [**Color Lisa**](http://colorlisa.com/). 26 | 27 | ```{r waffle, echo=FALSE, fig.height=2, warning=FALSE, message=FALSE} 28 | library(lisa) 29 | 30 | parts <- data.frame( 31 | names = names(lisa), 32 | vals = 1 33 | ) 34 | 35 | waffle::waffle(parts, rows = 5, colors = purrr::flatten_chr(lisa)) + 36 | ggplot2::theme(legend.position = "none") 37 | ``` 38 | 39 | ## Installation 40 | 41 | Install the released version of `lisa` from CRAN: 42 | 43 | ```r 44 | install.packages("lisa") 45 | ``` 46 | 47 | Or install the development version from GitHub with: 48 | 49 | ``` r 50 | # install.packages("devtools") 51 | devtools::install_github("tylurp/lisa") 52 | ``` 53 | 54 | If you aren't an R user, you might be interested in [palettes.yml](inst/extdata/palettes.yml) which contains all palettes in [YAML](https://en.wikipedia.org/wiki/YAML) format. 55 | 56 | ## Palettes 57 | 58 | Here's a sample of the available palettes: 59 | 60 | ```{r, include=FALSE} 61 | set.seed(4376) 62 | ``` 63 | 64 | ```{r example1, results='hide'} 65 | library(lisa) 66 | 67 | par(mfrow = c(6, 3)) 68 | lapply(sample(lisa, 18), plot) 69 | ``` 70 | 71 | You can also call and/or modify palettes using `lisa_palette`: 72 | 73 | ```{r example2, fig.height=1, results='hide'} 74 | x <- lisa_palette("JackBush_1", 1000, "continuous") 75 | y <- lisa_palette("PabloPicasso", 2, "discrete") 76 | z <- lisa_palette("KatsushikaHokusai", 1000, "continuous") 77 | lapply(list(x, y, z), plot) 78 | ``` 79 | 80 | All palettes have 3 attributes associated with them, you can access them with the `lisa` list: 81 | 82 | ```{r} 83 | lisa$VincentvanGogh 84 | ``` 85 | 86 | There is also a table with more information of all available palettes: 87 | 88 | ```{r} 89 | artwork 90 | ``` 91 | 92 | Example `ggplot2` usage: 93 | 94 | ```{r ggplot2-example, fig.height=4} 95 | library(ggplot2) 96 | 97 | ggplot(mtcars, aes(mpg, disp)) + 98 | geom_point(aes(col = factor(gear)), size = 5, show.legend = FALSE) + 99 | scale_color_manual(values = lisa$`Jean-MichelBasquiat`) + 100 | theme_void() 101 | ``` 102 | 103 | 104 | ## Acknowledgements 105 | 106 | * [**Color Lisa**](http://colorlisa.com/) for the color palettes 107 | * [`wesanderson`](https://github.com/karthik/wesanderson) for source code that powers most things in this repository 108 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | lisa 5 | =============================================================== 6 | 7 | 8 | 9 | [![R build 10 | status](https://github.com/tyluRp/lisa/workflows/R-CMD-check/badge.svg)](https://github.com/tyluRp/lisa/actions) 11 | [![CRAN 12 | status](https://www.r-pkg.org/badges/version/lisa)](https://cran.r-project.org/package=lisa) 13 | [![CRAN\_Download\_Badge](https://cranlogs.r-pkg.org/badges/lisa)](https://cran.r-project.org/package=lisa) 14 | [![Codecov test 15 | coverage](https://codecov.io/gh/tyluRp/lisa/branch/master/graph/badge.svg)](https://codecov.io/gh/tyluRp/lisa?branch=master) 16 | 17 | 18 | This is a color palette R package that contains 128 palettes from 19 | [**Color Lisa**](http://colorlisa.com/). 20 | 21 | 22 | 23 | Installation 24 | ------------ 25 | 26 | Install the released version of `lisa` from CRAN: 27 | 28 | install.packages("lisa") 29 | 30 | Or install the development version from GitHub with: 31 | 32 | # install.packages("devtools") 33 | devtools::install_github("tylurp/lisa") 34 | 35 | If you aren’t an R user, you might be interested in 36 | [palettes.yml](inst/extdata/palettes.yml) which contains all palettes in 37 | [YAML](https://en.wikipedia.org/wiki/YAML) format. 38 | 39 | Palettes 40 | -------- 41 | 42 | Here’s a sample of the available palettes: 43 | 44 | library(lisa) 45 | 46 | par(mfrow = c(6, 3)) 47 | lapply(sample(lisa, 18), plot) 48 | 49 | 50 | 51 | You can also call and/or modify palettes using `lisa_palette`: 52 | 53 | x <- lisa_palette("JackBush_1", 1000, "continuous") 54 | y <- lisa_palette("PabloPicasso", 2, "discrete") 55 | z <- lisa_palette("KatsushikaHokusai", 1000, "continuous") 56 | lapply(list(x, y, z), plot) 57 | 58 | 59 | 60 | All palettes have 3 attributes associated with them, you can access them 61 | with the `lisa` list: 62 | 63 | lisa$VincentvanGogh 64 | #> * Work: The Starry Night 65 | #> * Author: Vincent van Gogh 66 | #> * Colors: #1a3431 #2b41a7 #6283c8 #ccc776 #c7ad24 67 | 68 | There is also a table with more information of all available palettes: 69 | 70 | artwork 71 | #> # A tibble: 128 x 5 72 | #> author work palette colors url 73 | #> 74 | #> 1 Josef Alb… Adobe (Varian… JosefAlbers #D77186 #61A2… http://www.wikiart.org/… 75 | #> 2 Josef Alb… Homage to the… JosefAlber… #C00559 #DE1F… http://www.wikiart.org/… 76 | #> 3 Gretchen … Golden Cloud GretchenAl… #171635 #0022… https://www.google.com/… 77 | #> 4 Billy App… Rainbow BillyApple #F24D98 #813B… http://www.wikiart.org/… 78 | #> 5 Per Arnol… Spar PerArnoldi #C2151B #2021… http://www.moma.org/col… 79 | #> 6 Milton Av… Bicycle Rider… MiltonAvery #F3C937 #7B53… http://www.wikiart.org/… 80 | #> 7 Milton Av… Cello Player MiltonAver… #E2CACD #2E7C… http://www.wikiart.org/… 81 | #> 8 Hilma af … The Swan HilmaafKli… #D6CFC4 #466C… https://artblart.files.… 82 | #> 9 Jean-Mich… Untitled (Bla… Jean-Miche… #8CABD9 #F6A7… http://www.widewalls.ch… 83 | #> 10 Jean-Mich… DUSTHEADS Jean-Miche… #C11432 #009A… http://www.christies.co… 84 | #> # … with 118 more rows 85 | 86 | Example `ggplot2` usage: 87 | 88 | library(ggplot2) 89 | 90 | ggplot(mtcars, aes(mpg, disp)) + 91 | geom_point(aes(col = factor(gear)), size = 5, show.legend = FALSE) + 92 | scale_color_manual(values = lisa$`Jean-MichelBasquiat`) + 93 | theme_void() 94 | 95 | 96 | 97 | Acknowledgements 98 | ---------------- 99 | 100 | - [**Color Lisa**](http://colorlisa.com/) for the color palettes 101 | - [`wesanderson`](https://github.com/karthik/wesanderson) for source 102 | code that powers most things in this repository 103 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | destination: docs 2 | template: 3 | params: 4 | bootswatch: lumen 5 | ganalytics: UA-135464357-2 6 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 1% 9 | patch: 10 | default: 11 | target: auto 12 | threshold: 1% 13 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## Test environments 2 | * local R installation, R 4.0.2 3 | * ubuntu 16.04 (on travis-ci), R 4.0.2 4 | * win-builder (devel) 5 | 6 | ## R CMD check results 7 | 8 | 0 errors | 0 warnings | 1 note 9 | 10 | * This is a new release. In this version I have updated the artwork dataset and added a method of printing palettes. 11 | -------------------------------------------------------------------------------- /data-raw/build.R: -------------------------------------------------------------------------------- 1 | library(dplyr) 2 | library(stringr) 3 | library(rvest) 4 | 5 | # html content 6 | colorlisa <- read_html("http://colorlisa.com/") 7 | 8 | # colors in hexcodes 9 | colors <- colorlisa %>% 10 | html_nodes(xpath = "//div[@class='palette__content']") %>% 11 | html_text() %>% 12 | str_squish() 13 | 14 | # urls of the artwork 15 | url <- colorlisa %>% 16 | html_nodes(xpath = "//h3[@class='palette__author']") %>% 17 | html_nodes("a") %>% 18 | html_attr("href") 19 | 20 | # artwork name 21 | work <- colorlisa %>% 22 | html_nodes(xpath = "//h3[@class='palette__author']") %>% 23 | html_nodes("strong") %>% 24 | html_text() 25 | 26 | # author name 27 | author <- colorlisa %>% 28 | html_nodes(xpath = "//h3[@class='palette__author']") %>% 29 | html_text() %>% 30 | gsub(".*by", "", .) %>% 31 | str_squish() 32 | 33 | # list 34 | lisa <- str_split(colors, " ") 35 | for (i in seq_along(colors)) { 36 | lisa[i] <- structure( 37 | str_split(colors[i], " "), 38 | class = c("lisa_palette", class(colors[i])), 39 | name = author[i], 40 | work = work[i] 41 | ) 42 | } 43 | 44 | lisa <- str_split(colors, " ") 45 | for (i in seq_along(colors)) { 46 | attr(lisa[[i]], "class") <- c("lisa_palette", class(colors[i])) 47 | attr(lisa[[i]], "name") <- author[i] 48 | attr(lisa[[i]], "work") <- work[i] 49 | } 50 | 51 | listnames <- make.unique(gsub(" ", "", author), sep = "_") 52 | listnames[22:23] <- c("SalvadorDali", "SalvadorDali_1") 53 | listnames[71:72] <- c("ReneMagritte", "ReneMagritte_1") 54 | names(lisa) <- listnames 55 | 56 | # dataframe 57 | artwork <- tibble::tibble( 58 | author = author, 59 | work = work, 60 | palette = listnames, 61 | colors = colors, 62 | url = url 63 | ) 64 | 65 | usethis::use_data(lisa, overwrite = TRUE) 66 | usethis::use_data(artwork, overwrite = TRUE) 67 | -------------------------------------------------------------------------------- /data-raw/build_yaml.R: -------------------------------------------------------------------------------- 1 | # Store palettes as yaml, idea ripped from https://github.com/ewenme/ghibli 2 | # devtools::install_github('viking/r-yaml') 3 | 4 | library(dplyr) 5 | 6 | # converts to yaml, preview output 7 | lisa::lisa %>% 8 | .[1:3] %>% 9 | yaml::as.yaml() %>% 10 | cat(sep = "\n") 11 | 12 | # save it 13 | lisa::lisa %>% 14 | yaml::as.yaml() %>% 15 | write.table( 16 | here::here("inst/extdata/palettes.yml"), 17 | quote = FALSE, 18 | col.names = FALSE 19 | ) 20 | -------------------------------------------------------------------------------- /data/artwork.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/data/artwork.rda -------------------------------------------------------------------------------- /data/lisa.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/data/lisa.rda -------------------------------------------------------------------------------- /inst/extdata/palettes.yml: -------------------------------------------------------------------------------- 1 | JosefAlbers: 2 | - '#D77186' 3 | - '#61A2DA' 4 | - '#6CB7DA' 5 | - '#b5b5b3' 6 | - '#D75725' 7 | JosefAlbers_1: 8 | - '#C00559' 9 | - '#DE1F6C' 10 | - '#F3A20D' 11 | - '#F07A13' 12 | - '#DE6716' 13 | GretchenAlbrecht: 14 | - '#171635' 15 | - '#00225D' 16 | - '#763262' 17 | - '#CA7508' 18 | - '#E9A621' 19 | BillyApple: 20 | - '#F24D98' 21 | - '#813B7C' 22 | - '#59D044' 23 | - '#F3A002' 24 | - '#F2F44D' 25 | PerArnoldi: 26 | - '#C2151B' 27 | - '#2021A0' 28 | - '#3547B3' 29 | - '#E2C43F' 30 | - '#E0DCDD' 31 | MiltonAvery: 32 | - '#F3C937' 33 | - '#7B533E' 34 | - '#BFA588' 35 | - '#604847' 36 | - '#552723' 37 | MiltonAvery_1: 38 | - '#E2CACD' 39 | - '#2E7CA8' 40 | - '#F1C061' 41 | - '#DA7338' 42 | - '#741D13' 43 | HilmaafKlint: 44 | - '#D6CFC4' 45 | - '#466CA6' 46 | - '#D1AE45' 47 | - '#87240E' 48 | - '#040204' 49 | Jean-MichelBasquiat: 50 | - '#8CABD9' 51 | - '#F6A7B8' 52 | - '#F1EC7A' 53 | - '#1D4D9F' 54 | - '#F08838' 55 | Jean-MichelBasquiat_1: 56 | - '#C11432' 57 | - '#009ADA' 58 | - '#66A64F' 59 | - '#FDD10A' 60 | - '#070707' 61 | MaxBeckmann: 62 | - '#4B3A51' 63 | - '#A77A4B' 64 | - '#ECC6A2' 65 | - '#A43020' 66 | - '#722D24' 67 | FernandoBotero: 68 | - '#99B6BD' 69 | - '#B3A86A' 70 | - '#ECC9A0' 71 | - '#D4613E' 72 | - '#BB9568' 73 | SandroBotticelli: 74 | - '#7A989A' 75 | - '#849271' 76 | - '#C1AE8D' 77 | - '#CF9546' 78 | - '#C67052' 79 | SandroBotticelli_1: 80 | - '#272725' 81 | - '#DDBD85' 82 | - '#DA694F' 83 | - '#A54A48' 84 | - '#FDFFE5' 85 | PieterBruegel: 86 | - '#BFBED5' 87 | - '#7F9086' 88 | - '#A29A68' 89 | - '#676A4F' 90 | - '#A63C24' 91 | JackBush: 92 | - '#529DCB' 93 | - '#ECA063' 94 | - '#71BF50' 95 | - '#F3CC4F' 96 | - '#D46934' 97 | JackBush_1: 98 | - '#A1D8B6' 99 | - '#D2C48E' 100 | - '#F45F40' 101 | - '#F9AE8D' 102 | - '#80B9CE' 103 | MaryCassatt: 104 | - '#1C5679' 105 | - '#BBB592' 106 | - '#CAC3B2' 107 | - '#808C5C' 108 | - '#5F4B3B' 109 | PaulCézanne: 110 | - '#8399B3' 111 | - '#697A55' 112 | - '#C4AA88' 113 | - '#B68E52' 114 | - '#8C5B28' 115 | MarcChagall: 116 | - '#3F6F76' 117 | - '#69B7CE' 118 | - '#C65840' 119 | - '#F4CE4B' 120 | - '#62496F' 121 | C.M.Coolidge: 122 | - '#204035' 123 | - '#4A7169' 124 | - '#BEB59C' 125 | - '#735231' 126 | - '#49271B' 127 | SalvadorDali: 128 | - '#40798C' 129 | - '#bca455' 130 | - '#bfb37f' 131 | - '#805730' 132 | - '#514A2E' 133 | SalvadorDali_1: 134 | - '#9BC0CC' 135 | - '#CAD8D8' 136 | - '#D0CE9F' 137 | - '#806641' 138 | - '#534832' 139 | LeonardodaVinci: 140 | - '#C8B272' 141 | - '#a88b4c' 142 | - '#a0a584' 143 | - '#697153' 144 | - '#43362a' 145 | GeneDavis: 146 | - '#293757' 147 | - '#568D4B' 148 | - '#D5BB56' 149 | - '#D26A1B' 150 | - '#A41D1A' 151 | GiorgiodeChirico: 152 | - '#27403D' 153 | - '#48725C' 154 | - '#212412' 155 | - '#F3E4C2' 156 | - '#D88F2E' 157 | GiorgiodeChirico_1: 158 | - '#2992BF' 159 | - '#4CBED9' 160 | - '#292C17' 161 | - '#F9F6EF' 162 | - '#F0742A' 163 | EdgarDegas: 164 | - '#BDB592' 165 | - '#ACBBC5' 166 | - '#9E8D3D' 167 | - '#8C4F36' 168 | - '#2C2D2C' 169 | RobertDelaunay: 170 | - '#4368B6' 171 | - '#78A153' 172 | - '#DEC23B' 173 | - '#E4930A' 174 | - '#C53211' 175 | RobertDelaunay_1: 176 | - '#A4B7E1' 177 | - '#B8B87A' 178 | - '#EFDE80' 179 | - '#EFBD37' 180 | - '#A85E5E' 181 | CharlesDemuth: 182 | - '#e4af79' 183 | - '#df9c41' 184 | - '#af7231' 185 | - '#923621' 186 | - '#2D2A28' 187 | RichardDiebenkorn: 188 | - '#2677A5' 189 | - '#639BC1' 190 | - '#639BC1' 191 | - '#90A74A' 192 | - '#5D8722' 193 | OttoDix: 194 | - '#1E1D20' 195 | - '#B66636' 196 | - '#547A56' 197 | - '#BDAE5B' 198 | - '#515A7C' 199 | OttoDix_1: 200 | - '#E0DBC8' 201 | - '#C9BE90' 202 | - '#76684B' 203 | - '#CDAB7E' 204 | - '#3C2B23' 205 | MarcelDuchamp: 206 | - '#d0cec2' 207 | - '#7baa80' 208 | - '#4b6b5e' 209 | - '#bf9a41' 210 | - '#980019' 211 | AlbrechtDürer: 212 | - '#657359' 213 | - '#9AA582' 214 | - '#8B775F' 215 | - '#D7C9BE' 216 | - '#F1E4DB' 217 | MaxErnst: 218 | - '#91323A' 219 | - '#3A4960' 220 | - '#D7C969' 221 | - '#6D7345' 222 | - '#554540' 223 | M.C.Escher: 224 | - '#C1395E' 225 | - '#AEC17B' 226 | - '#F0CA50' 227 | - '#E07B42' 228 | - '#89A7C2' 229 | PaulFeeley: 230 | - '#2C458D' 231 | - '#E4DFD9' 232 | - '#425B4F' 233 | - '#EBAD30' 234 | - '#BF2124' 235 | LorserFeitelson: 236 | - '#202221' 237 | - '#661E2A' 238 | - '#AB381B' 239 | - '#EAD4A3' 240 | - '#E3DED8' 241 | HelenFrankenthaler: 242 | - '#5D7342' 243 | - '#D7AE04' 244 | - '#ECD7B8' 245 | - '#A58B8C' 246 | - '#272727' 247 | LucianFreud: 248 | - '#e1d2bd' 249 | - '#a77e5e' 250 | - '#2d291d' 251 | - '#85868b' 252 | - '#83774d' 253 | TerryFrost: 254 | - '#EF5950' 255 | - '#8D5A78' 256 | - '#C66F26' 257 | - '#FB6B22' 258 | - '#DC2227' 259 | PaulGauguin: 260 | - '#21344F' 261 | - '#8AAD05' 262 | - '#E2CE1B' 263 | - '#DF5D22' 264 | - '#E17976' 265 | RupprechtGeiger: 266 | - '#FF62A9' 267 | - '#F77177' 268 | - '#FA9849' 269 | - '#FE6E3A' 270 | - '#FD5A35' 271 | HansHofmann: 272 | - '#1A6DED' 273 | - '#2C7CE6' 274 | - '#145CBF' 275 | - '#162B3D' 276 | - '#F9ECE4' 277 | KatsushikaHokusai: 278 | - '#1F284C' 279 | - '#2D4472' 280 | - '#6E6352' 281 | - '#D9CCAC' 282 | - '#ECE2C6' 283 | WinslowHomer: 284 | - '#A9944A' 285 | - '#F2D9B3' 286 | - '#725435' 287 | - '#8E9DBF' 288 | - '#BD483C' 289 | EdwardHopper: 290 | - '#67161C' 291 | - '#3F6148' 292 | - '#DBD3A4' 293 | - '#A4804C' 294 | - '#4B5F80' 295 | RobertIndiana: 296 | - '#2659D8' 297 | - '#1C6FF3' 298 | - '#5EBC4E' 299 | - '#53A946' 300 | - '#F24534' 301 | JamesJean: 302 | - '#51394E' 303 | - '#F6DE7D' 304 | - '#C8AF8A' 305 | - '#658385' 306 | - '#B04838' 307 | JasperJohns: 308 | - '#4B6892' 309 | - '#F9E583' 310 | - '#FED43F' 311 | - '#F6BD28' 312 | - '#BE4C46' 313 | FridaKahlo: 314 | - '#121510' 315 | - '#6D8325' 316 | - '#D6CFB7' 317 | - '#E5AD4F' 318 | - '#BD5630' 319 | WassilyKandinsky: 320 | - '#5D7388' 321 | - '#A08F27' 322 | - '#E5A729' 323 | - '#4F4D1D' 324 | - '#8AAE8A' 325 | WassilyKandinsky_1: 326 | - '#d2981a' 327 | - '#a53e1f' 328 | - '#457277' 329 | - '#8dcee2' 330 | - '#8f657d' 331 | WassilyKandinsky_2: 332 | - '#C13C53' 333 | - '#DA73A8' 334 | - '#4052BD' 335 | - '#EFE96D' 336 | - '#D85143' 337 | PaulKlee: 338 | - '#A7B3CD' 339 | - '#E6DA9E' 340 | - '#676155' 341 | - '#CDB296' 342 | - '#CCD7AD' 343 | PaulKlee_1: 344 | - '#4F51FE' 345 | - '#8C1E92' 346 | - '#FF4E0B' 347 | - '#CD2019' 348 | - '#441C21' 349 | YvesKlein: 350 | - '#344CB9' 351 | - '#1B288A' 352 | - '#0F185B' 353 | - '#D7C99A' 354 | - '#F2E4C7' 355 | GustavKlimt: 356 | - '#4A5FAB' 357 | - '#609F5C' 358 | - '#E3C454' 359 | - '#A27CBA' 360 | - '#B85031' 361 | JeffKoons: 362 | - '#D6AABE' 363 | - '#B69F7F' 364 | - '#ECD9AD' 365 | - '#76A9A2' 366 | - '#A26775' 367 | LeeKrasner: 368 | - '#333333' 369 | - '#D1B817' 370 | - '#2A2996' 371 | - '#B34325' 372 | - '#C8CCC6' 373 | JacobLawrence: 374 | - '#614671' 375 | - '#BE994A' 376 | - '#C8B595' 377 | - '#BD4335' 378 | - '#8B3834' 379 | JacobLawrence_1: 380 | - '#5E3194' 381 | - '#9870B9' 382 | - '#F1B02F' 383 | - '#EA454C' 384 | - '#CC0115' 385 | SolLeWitt: 386 | - '#0A71B6' 387 | - '#F9C40A' 388 | - '#190506' 389 | - '#EB5432' 390 | - '#EAF2F0' 391 | RoyLichtenstein: 392 | - '#3229ad' 393 | - '#bc000e' 394 | - '#e7cfb7' 395 | - '#ffec04' 396 | - '#090109' 397 | RoyLichtenstein_1: 398 | - '#00020E' 399 | - '#FFDE01' 400 | - '#A5BAD6' 401 | - '#F1C9C7' 402 | - '#BD0304' 403 | RoyLichtenstein_2: 404 | - '#c7991f' 405 | - '#c63d33' 406 | - '#23254c' 407 | - '#e0c4ae' 408 | - '#d5d0b2' 409 | KazimirMalevich: 410 | - '#151817' 411 | - '#001A56' 412 | - '#197C3F' 413 | - '#D4A821' 414 | - '#C74C25' 415 | ÉdouardManet: 416 | - '#6486AD' 417 | - '#2D345D' 418 | - '#D9BE7F' 419 | - '#5A3A26' 420 | - '#C6A490' 421 | ReneMagritte: 422 | - '#B60614' 423 | - '#3A282F' 424 | - '#909018' 425 | - '#E3BFA1' 426 | - '#EE833E' 427 | ReneMagritte_1: 428 | - '#B6B3BB' 429 | - '#697D8E' 430 | - '#B8B87E' 431 | - '#6F5F4B' 432 | - '#292A2D' 433 | Masaccio: 434 | - '#0e2523' 435 | - '#324028' 436 | - '#c26b61' 437 | - '#5a788d' 438 | - '#de7944' 439 | Michelangelo: 440 | - '#42819F' 441 | - '#86AA7D' 442 | - '#CBB396' 443 | - '#555234' 444 | - '#4D280F' 445 | JoanMiró: 446 | - '#C04759' 447 | - '#3B6C73' 448 | - '#383431' 449 | - '#F1D87F' 450 | - '#EDE5D2' 451 | AmedeoModigliani: 452 | - '#1d2025' 453 | - '#45312a' 454 | - '#7e2f28' 455 | - '#202938' 456 | - '#d58e40' 457 | PietMondrian: 458 | - '#314290' 459 | - '#4A71C0' 460 | - '#F1F2ED' 461 | - '#F0D32D' 462 | - '#AB3A2C' 463 | ClaudeMonet: 464 | - '#184430' 465 | - '#548150' 466 | - '#DEB738' 467 | - '#734321' 468 | - '#852419' 469 | ClaudeMonet_1: 470 | - '#9F4640' 471 | - '#4885A4' 472 | - '#395A92' 473 | - '#7EA860' 474 | - '#B985BA' 475 | ClaudeMonet_2: 476 | - '#82A4BC' 477 | - '#4C7899' 478 | - '#2F5136' 479 | - '#B1B94C' 480 | - '#E5DCBE' 481 | EdvardMunch: 482 | - '#5059A1' 483 | - '#EFC337' 484 | - '#1F386E' 485 | - '#D1AE82' 486 | - '#BE3B2C' 487 | EdvardMunch_1: 488 | - '#272A2A' 489 | - '#E69253' 490 | - '#EDB931' 491 | - '#E4502E' 492 | - '#4378A0' 493 | BarnettNewman: 494 | - '#442327' 495 | - '#C0BC98' 496 | - '#A6885D' 497 | - '#8A3230' 498 | - '#973B2B' 499 | KennethNoland: 500 | - '#D0D8CD' 501 | - '#586180' 502 | - '#E2AC29' 503 | - '#1A1915' 504 | - '#E6E1CE' 505 | GeorgiaO'Keeffe: 506 | - '#0E122D' 507 | - '#182044' 508 | - '#51628E' 509 | - '#91A1BA' 510 | - '#AFD0C9' 511 | ClaesOldenburg: 512 | - '#95B1C9' 513 | - '#263656' 514 | - '#698946' 515 | - '#F8D440' 516 | - '#C82720' 517 | PabloPicasso: 518 | - '#CD6C74' 519 | - '#566C7D' 520 | - '#DD9D91' 521 | - '#A1544B' 522 | - '#D5898D' 523 | PabloPicasso_1: 524 | - '#4E7989' 525 | - '#A9011B' 526 | - '#E4A826' 527 | - '#80944E' 528 | - '#DCD6B2' 529 | JacksonPollock: 530 | - '#D89CA9' 531 | - '#1962A0' 532 | - '#F1ECD7' 533 | - '#E8C051' 534 | - '#1A1C23' 535 | Prince: 536 | - '#735bcc' 537 | - '#6650b4' 538 | - '#59449c' 539 | - '#4b3984' 540 | - '#3e2d6c' 541 | JohnQuidor: 542 | - '#B79A59' 543 | - '#826C37' 544 | - '#54442F' 545 | - '#DBCEAF' 546 | - '#C4AA52' 547 | MelRamos: 548 | - '#C13E43' 549 | - '#376EA5' 550 | - '#565654' 551 | - '#F9D502' 552 | - '#E7CA6B' 553 | OdilonRedon: 554 | - '#695B8F' 555 | - '#B26C61' 556 | - '#C2AF46' 557 | - '#4D5E30' 558 | - '#8B1F1D' 559 | Rembrandt: 560 | - '#DBC99A' 561 | - '#A68329' 562 | - '#5B5224' 563 | - '#8A350C' 564 | - '#090A04' 565 | Pierre-AugusteRenoir: 566 | - '#2B5275' 567 | - '#A69F55' 568 | - '#F1D395' 569 | - '#FFFBDD' 570 | - '#D16647' 571 | Pierre-AugusteRenoir_1: 572 | - '#303241' 573 | - '#B7A067' 574 | - '#C8C2B2' 575 | - '#686D4F' 576 | - '#4D3930' 577 | BridgetRiley: 578 | - '#FAB9AC' 579 | - '#7BBC53' 580 | - '#DE6736' 581 | - '#67C1EC' 582 | - '#E6B90D' 583 | JamesRosenquist: 584 | - '#E25D75' 585 | - '#3F4C8C' 586 | - '#6A79B0' 587 | - '#D7BC1F' 588 | - '#DCCFAB' 589 | MarkRothko: 590 | - '#E49A16' 591 | - '#E19713' 592 | - '#D67629' 593 | - '#DA6E2E' 594 | - '#D85434' 595 | MarkRothko_1: 596 | - '#D5D6D1' 597 | - '#BEC0BF' 598 | - '#5B382C' 599 | - '#39352C' 600 | - '#1B1B1B' 601 | JohnSingerSargent: 602 | - '#b43a35' 603 | - '#3e501e' 604 | - '#f8f2f4' 605 | - '#6b381d' 606 | - '#20242d' 607 | JohnSingerSargent_1: 608 | - '#778BD0' 609 | - '#E2D76B' 610 | - '#95BF78' 611 | - '#4E6A3D' 612 | - '#5F4F38' 613 | JohnSingerSargent_2: 614 | - '#EEC7A0' 615 | - '#EAA69C' 616 | - '#BD7C96' 617 | - '#A1A481' 618 | - '#D97669' 619 | OskarSchlemmer: 620 | - '#3A488A' 621 | - '#8785B2' 622 | - '#DABD61' 623 | - '#D95F30' 624 | - '#BE3428' 625 | GeorgesSeurat: 626 | - '#3F3F63' 627 | - '#808EB7' 628 | - '#465946' 629 | - '#8C9355' 630 | - '#925E48' 631 | SandySkoglund: 632 | - '#d7f96e' 633 | - '#457d24' 634 | - '#879387' 635 | - '#e1c39f' 636 | - '#394835' 637 | PavelTchelitchew: 638 | - '#ac2527' 639 | - '#f8cc5a' 640 | - '#5c8447' 641 | - '#61221a' 642 | - '#2b4868' 643 | J.M.W.Turner: 644 | - '#F1ECCE' 645 | - '#9EA3B5' 646 | - '#E9D688' 647 | - '#A85835' 648 | - '#AE8045' 649 | CyTwombly: 650 | - '#F2788F' 651 | - '#F591EA' 652 | - '#F0C333' 653 | - '#F5C2AF' 654 | - '#F23B3F' 655 | JohannJacobUlrich: 656 | - '#FDDDAB' 657 | - '#E7A974' 658 | - '#A87250' 659 | - '#7B533D' 660 | - '#6A4531' 661 | TheovanDoesburg: 662 | - '#BD748F' 663 | - '#3D578E' 664 | - '#BFAB68' 665 | - '#DAD7D0' 666 | - '#272928' 667 | TheovanDoesburg_1: 668 | - '#53628D' 669 | - '#B8B45B' 670 | - '#C1C3B6' 671 | - '#984F48' 672 | - '#2E3432' 673 | JanvanEyck: 674 | - '#3C490C' 675 | - '#3B5B71' 676 | - '#262121' 677 | - '#7C6C4E' 678 | - '#6C2B23' 679 | VincentvanGogh: 680 | - '#1a3431' 681 | - '#2b41a7' 682 | - '#6283c8' 683 | - '#ccc776' 684 | - '#c7ad24' 685 | VincentvanGogh_1: 686 | - '#FBDC30' 687 | - '#A7A651' 688 | - '#E0BA7A' 689 | - '#9BA7B0' 690 | - '#5A5F80' 691 | VincentvanGogh_2: 692 | - '#374D8D' 693 | - '#93A0CB' 694 | - '#82A866' 695 | - '#C4B743' 696 | - '#A35029' 697 | RemediosVaro: 698 | - '#C8DAAD' 699 | - '#989E53' 700 | - '#738D60' 701 | - '#DEBC31' 702 | - '#9D471A' 703 | DiegoVelázquez: 704 | - '#413A2C' 705 | - '#241F1A' 706 | - '#C5B49B' 707 | - '#A57F5B' 708 | - '#5C351E' 709 | JohannesVermeer: 710 | - '#0C0B10' 711 | - '#707DA6' 712 | - '#CCAD9D' 713 | - '#B08E4A' 714 | - '#863B34' 715 | JohannesVermeer_1: 716 | - '#022F69' 717 | - '#D6C17A' 718 | - '#D8D0BE' 719 | - '#6B724B' 720 | - '#7C3E2F' 721 | AndyWarhol: 722 | - '#F26386' 723 | - '#F588AF' 724 | - '#A4D984' 725 | - '#FCBC52' 726 | - '#FD814E' 727 | AndyWarhol_1: 728 | - '#FD0C81' 729 | - '#FFED4D' 730 | - '#C34582' 731 | - '#EBA49E' 732 | - '#272324' 733 | AndyWarhol_2: 734 | - '#D32934' 735 | - '#2F191B' 736 | - '#2BAA92' 737 | - '#D12E6C' 738 | - '#F4BCB9' 739 | AndyWarhol_3: 740 | - '#a99364' 741 | - '#da95aa' 742 | - '#f4f0e4' 743 | - '#b74954' 744 | - '#c2ddb2' 745 | GrantWood: 746 | - '#A6BDB0' 747 | - '#8B842F' 748 | - '#41240B' 749 | - '#9C4823' 750 | - '#D6AA7E' 751 | FrancescoXanto: 752 | - '#2C6AA5' 753 | - '#D9AE2C' 754 | - '#DDC655' 755 | - '#D88C27' 756 | - '#64894D' 757 | JackYoungerman: 758 | - '#59A55D' 759 | - '#EFDB56' 760 | - '#7D9DC6' 761 | - '#ECA23F' 762 | - '#CA4D2A' 763 | KarlZerbe: 764 | - '#46734F' 765 | - '#CAAB6C' 766 | - '#D0CCAF' 767 | - '#617F97' 768 | - '#9A352D' 769 | 770 | -------------------------------------------------------------------------------- /lisa.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageRoxygenize: rd,collate,namespace 22 | -------------------------------------------------------------------------------- /man/artwork.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lisa.R 3 | \docType{data} 4 | \name{artwork} 5 | \alias{artwork} 6 | \title{Artist, palettes, and artwork names} 7 | \format{ 8 | A data frame with 128 rows and 3 variables: 9 | \describe{ 10 | \item{author}{name of artist} 11 | \item{work}{name of artwork} 12 | \item{palette}{name of the palette} 13 | \item{colors}{hex color codes} 14 | \item{url}{url for artwork info} 15 | } 16 | } 17 | \usage{ 18 | artwork 19 | } 20 | \value{ 21 | a \link[tibble:tibble-package]{tibble} 22 | 23 | Source: \url{http://colorlisa.com/} 24 | } 25 | \description{ 26 | A table containing various information about each palette. 27 | } 28 | \keyword{datasets} 29 | -------------------------------------------------------------------------------- /man/figures/README-example1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/man/figures/README-example1-1.png -------------------------------------------------------------------------------- /man/figures/README-example2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/man/figures/README-example2-1.png -------------------------------------------------------------------------------- /man/figures/README-example2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/man/figures/README-example2-2.png -------------------------------------------------------------------------------- /man/figures/README-example2-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/man/figures/README-example2-3.png -------------------------------------------------------------------------------- /man/figures/README-ggplot2-example-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/man/figures/README-ggplot2-example-1.png -------------------------------------------------------------------------------- /man/figures/README-waffle-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/man/figures/README-waffle-1.png -------------------------------------------------------------------------------- /man/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/man/figures/logo.png -------------------------------------------------------------------------------- /man/lisa.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lisa.R 3 | \docType{data} 4 | \name{lisa} 5 | \alias{lisa} 6 | \title{List of all available palettes} 7 | \format{ 8 | An object of class \code{list} of length 128. 9 | } 10 | \usage{ 11 | lisa 12 | } 13 | \description{ 14 | A list containing all available palettes (128) and their attributes (class, 15 | artist name and the name of the artwork). 16 | } 17 | \details{ 18 | Source: \url{http://colorlisa.com/} 19 | } 20 | \keyword{datasets} 21 | -------------------------------------------------------------------------------- /man/lisa_palette.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lisa.R 3 | \name{lisa_palette} 4 | \alias{lisa_palette} 5 | \title{Call or modify lisa palettes} 6 | \usage{ 7 | lisa_palette(name, n, type = c("discrete", "continuous")) 8 | } 9 | \arguments{ 10 | \item{name}{Name of desired palette. See \code{names(lisa)}.} 11 | 12 | \item{n}{Number of colors desired.} 13 | 14 | \item{type}{Either "continuous" or "discrete". Use continuous if you want 15 | to automatically interpolate between colors.} 16 | } 17 | \value{ 18 | A vector of colors. 19 | } 20 | \description{ 21 | Call or modify lisa palettes 22 | } 23 | \examples{ 24 | lisa_palette(name = "Prince", n = 10, type = "continuous") 25 | lisa_palette("PabloPicasso", 2, "discrete") 26 | } 27 | -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/pkgdown/favicon/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/pkgdown/favicon/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/pkgdown/favicon/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/pkgdown/favicon/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/pkgdown/favicon/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/pkgdown/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/pkgdown/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/pkgdown/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerlittlefield/lisa/91f7f3f59ff60a89a161a9f8ff5be0804e7dd137/pkgdown/favicon/favicon.ico -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(lisa) 3 | 4 | test_check("lisa") 5 | -------------------------------------------------------------------------------- /tests/testthat/test-attributes.R: -------------------------------------------------------------------------------- 1 | context("test-attributes") 2 | 3 | test_that("attributes are intact", { 4 | 5 | # confirm that attributes for each palette are intact, this also checks the 6 | # order of attribtues, if they were rearranged, this test would fail 7 | unique_atts <- unlist(unique(lapply(lisa, function(x) names(attributes(x))))) 8 | atts_intact <- all(unique_atts == c("class", "name", "work")) 9 | expect_true(atts_intact) 10 | 11 | unique_class <- unlist(unique(lapply(lisa, function(x) class(x)))) 12 | class_intact <- all(unique_class == c("lisa_palette", "character")) 13 | expect_true(class_intact) 14 | 15 | expect_true(unlist(unique(lapply(lisa, function(x) lisa:::is.lisa_palette(x))))) 16 | 17 | expect_equal(names(attributes(lisa::lisa_palette("JosefAlbers"))), c("class", "name", "work")) 18 | 19 | }) 20 | -------------------------------------------------------------------------------- /tests/testthat/test-lisa-data.R: -------------------------------------------------------------------------------- 1 | context("test-lisa-data") 2 | 3 | test_that("lisa data", { 4 | 5 | # confirm that lisa is a list and artwork is a data.frame 6 | expect_true(class(lisa) == "list") 7 | expect_true(all(class(artwork) %in% c("data.frame", "tbl_df", "tbl"))) 8 | 9 | }) 10 | -------------------------------------------------------------------------------- /tests/testthat/test-lisa_palette.R: -------------------------------------------------------------------------------- 1 | context("test-lisa_palette") 2 | 3 | test_that("lisa_palette works", { 4 | 5 | # various lisa_palette tests 6 | expect_error(lisa::lisa_palette("JosefAlbers", -1)) 7 | expect_error(lisa::lisa_palette("JosefAlbers", Inf)) 8 | expect_length(lisa::lisa_palette("JosefAlbers"), 5) 9 | expect_error(lisa::lisa_palette("JosefAlbers",20)) 10 | expect_error(lisa::lisa_palette("JosefAlbers", 20, "discrete")) 11 | expect_length(lisa::lisa_palette("JosefAlbers", 20, "continuous"), 20) 12 | expect_error(lisa::lisa_palette("NotAPalette")) 13 | 14 | }) 15 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /vignettes/lisa-palette.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "How does lisa palette work?" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteIndexEntry{How does lisa palette work?} 6 | %\VignetteEngine{knitr::rmarkdown} 7 | %\VignetteEncoding{UTF-8} 8 | --- 9 | 10 | ```{r, include = FALSE} 11 | knitr::opts_chunk$set( 12 | collapse = TRUE, 13 | comment = "#>" 14 | ) 15 | ``` 16 | 17 | The function `lisa_palette` allows users to call and modify palettes by adjusting the parameters `n` and `type` where `n` represents the number of colors and `type` represents _discrete_ or _continuous_. So how does this work? Under the hood, `grDevices::colorRampPalette()` is doing all the work, see [here](https://github.com/tyluRp/lisa/blob/d59da6904dad2391a29ec194d8a673c68df943b5/R/lisa.R#L53). Unfortunately, I am unable to dive into the details of how `colorRampPalette()` works but we can at least see how this works visually. The palette we will use is `AndyWarhol_3`, Andy Warhol's [_Mick Jagger_](https://www.moma.org/collection/works/71518?locale=en). 18 | 19 | ```{r setup, fig.height=1} 20 | library(lisa) 21 | 22 | plot(lisa$AndyWarhol_3) 23 | ``` 24 | 25 | To compare how things change with `lisa_palette` we can create a list of 10 palettes: 26 | 27 | 1. 5 discrete palettes with n = 1:5 28 | 2. 5 continuous palettes with n = 1:5 29 | 30 | Note: You will not be able to reproduce this plot with the released version from CRAN, install the latest from GitHub if you want to reproduce. The CRAN version doesn't allow you to modify the plot title. 31 | 32 | ```{r, fig.height = 2, results='hide'} 33 | x <- lapply(1:5, function(x) structure(lisa_palette("AndyWarhol_3", n = x, "continuous"), name = paste0(x, ", continuous"))) 34 | y <- lapply(1:5, function(x) structure(lisa_palette("AndyWarhol_3", n = x, "discrete"), name = paste0(x, ", discrete"))) 35 | 36 | par(mfrow = c(2, 5)) 37 | lapply(c(x, y), plot) 38 | ``` 39 | 40 | The behavior for discrete palettes is pretty straight forward, it just picks 1:n colors from the palette vector, for example: 41 | 42 | ```{r} 43 | lisa$AndyWarhol_3[1:3] 44 | lisa_palette("AndyWarhol_3", n = 3, type = "discrete") 45 | ``` 46 | 47 | If you ask for more than 5 colors palettes, it'll throw an error because only 5 exist. 48 | 49 | ```{r, error=TRUE} 50 | lisa_palette("AndyWarhol_3", n = 6, type = "discrete") 51 | ``` 52 | 53 | The behavior for continuous palettes is a bit different, it tries to interpolate a set of colors to create a new palette. It does this with `colorRampPalette()` from the `grDevices` package: 54 | 55 | ```{r} 56 | grDevices::colorRampPalette(lisa$AndyWarhol_3)(3) 57 | ``` 58 | 59 | Which is equivalent to: 60 | 61 | ```{r} 62 | ramp <- colorRamp(lisa$AndyWarhol_3) 63 | x <- ramp(seq.int(0, 1, length.out = 3)) 64 | if (ncol(x) == 4L) { 65 | rgb(x[, 1L], x[, 2L], x[, 3L], x[, 4L], maxColorValue = 255) 66 | } else { 67 | rgb(x[, 1L], x[, 2L], x[, 3L], maxColorValue = 255) 68 | } 69 | ``` 70 | 71 | Where the code chunk above is the source code for `colorRampPalette()` with a few changes to the formatting, see [here](https://github.com/wch/r-source/blob/5a156a0865362bb8381dcd69ac335f5174a4f60c/src/library/grDevices/R/colorRamp.R) for the true source code. 72 | 73 | Having said all of this, in order to truly understand how this works, you would need to analyze that chunk of code and any other chunks that it depends on. Beware, from this point on it gets complicated (for me at least) and I don't think I could accurately articulate what's going on behind the scenes, so I wont. 74 | 75 | In short, `colorRampPalette()` depends on a secondary function `colorRamp()` which depends on `convertColor()` and so on, see the history of these functions [here](https://github.com/wch/r-source/commits/5a156a0865362bb8381dcd69ac335f5174a4f60c/src/library/grDevices/R/colorRamp.R) and the initial commit [here](https://github.com/wch/r-source/commit/ea07369869b3ab1f2fa05fb221a57a5b117c0fc5#diff-10c83c04d434b2bd02fbbcb84dd92cfb) by [Thomas Lumley](https://twitter.com/tslumley) in 2004. Whats interesting is the [link](http://www.brucelindbloom.com/) Thomas provided in the source code which seems to be where a lot of the math involved in color interpolation comes from. For the layman like myself, I will just embrace the magic behind color interpolation. 76 | 77 | ```{r, fig.height=1, results='hide'} 78 | x <- lisa$AndyWarhol_3 79 | y <- lisa_palette("AndyWarhol_3", 1000, "continuous") 80 | 81 | lapply(list(x, y), plot) 82 | ``` 83 | 84 | --------------------------------------------------------------------------------