diff --git a/README.Rmd b/README.Rmd index f054eed..1e23a62 100644 --- a/README.Rmd +++ b/README.Rmd @@ -14,6 +14,7 @@ knitr::opts_chunk$set( # tinter + [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing) [![Travis build status](https://travis-ci.org/poissonconsulting/tinter.svg?branch=master)](https://travis-ci.org/poissonconsulting/tinter) [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/sebdalgarno/tinter?branch=master&svg=true)](https://ci.appveyor.com/project/sebdalgarno/tinter) diff --git a/README.md b/README.md index 5d68d2d..d1f9bd2 100644 --- a/README.md +++ b/README.md @@ -1,78 +1,76 @@ ---- -output: github_document ---- - - # tinter [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing) -[![Travis build status](https://travis-ci.org/poissonconsulting/tinter.svg?branch=master)](https://travis-ci.org/poissonconsulting/tinter) - [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/sebdalgarno/tinter?branch=master&svg=true)](https://ci.appveyor.com/project/sebdalgarno/tinter) - [![Coverage status](https://codecov.io/gh/poissonconsulting/tinter/branch/master/graph/badge.svg)](https://codecov.io/github/poissonconsulting/tinter?branch=master) -[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) -[![CRAN status](https://www.r-pkg.org/badges/version/tinter)](https://cran.r-project.org/package=tinter) +[![Travis build +status](https://travis-ci.org/poissonconsulting/tinter.svg?branch=master)](https://travis-ci.org/poissonconsulting/tinter) +[![AppVeyor build +status](https://ci.appveyor.com/api/projects/status/github/sebdalgarno/tinter?branch=master&svg=true)](https://ci.appveyor.com/project/sebdalgarno/tinter) +[![Coverage +status](https://codecov.io/gh/poissonconsulting/tinter/branch/master/graph/badge.svg)](https://codecov.io/github/poissonconsulting/tinter?branch=master) +[![License: +MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) +[![CRAN +status](https://www.r-pkg.org/badges/version/tinter)](https://cran.r-project.org/package=tinter) ![CRAN Downloads](http://cranlogs.r-pkg.org/badges/grand-total/tinter) -### Introduction -`tinter` provides a simple way to generate monochromatic palettes. Easily define: +### Introduction + +`tinter` provides a simple way to generate monochromatic palettes. +Easily define: -+ palette direction ("shades", "tints", or "both"). -+ number of colours to generate on either side (`steps`). -+ number of colours to remove from extreme end(s) of palette (e.g. default `crop = 1` eliminates black and white). -+ darker or lighter output (`adjust`). + - palette direction (“shades”, “tints”, or “both”). + - number of colours to generate on either side (`steps`). + - number of colours to remove from extreme end(s) of palette + (e.g. default `crop = 1` eliminates black and white). + - darker or lighter output (`adjust`). + -```r +``` r library(tinter) hex <- "#335CAC" ``` -![plot of chunk colour](figure/colour-1.png) +![](README_files/figure-gfm/colour-1.png) - -```r +``` r tinter(hex) #> [1] "#D6DEEE" "#ADBDDD" "#849DCD" "#5B7CBC" "#335CAC" "#284989" "#1E3767" #> [8] "#142444" "#0A1222" ``` -![plot of chunk tinter](figure/tinter-1.png) - +![](README_files/figure-gfm/tinter-1.png) -```r +``` r tinter(hex, direction = "tints") ``` -![plot of chunk tints](figure/tints-1.png) +![](README_files/figure-gfm/tints-1.png) - -```r +``` r tinter(hex, steps = 10) ``` -![plot of chunk steps](figure/steps-1.png) - +![](README_files/figure-gfm/steps-1.png) -```r +``` r tinter(hex, steps = 10, crop = 7) ``` -![plot of chunk crop](figure/crop-1.png) - +![](README_files/figure-gfm/crop-1.png) -```r +``` r tinter(hex, steps = 10, crop = 7, adjust = 0.4) ``` -![plot of chunk darken](figure/darken-1.png) +![](README_files/figure-gfm/darken-1.png) ### Create a choropleth map - -```r +``` r library(ggplot2) library(sf) @@ -86,13 +84,14 @@ ggplot(data = nc) + coord_sf(datum = NA) ``` -![plot of chunk plot](figure/plot-1.png) +![](README_files/figure-gfm/plot-1.png) -### Doesn't this already exist? -`tinter` just simplifies a task usually done with `grDevices`. It's default is to remove black and white from the palette. +### Doesn’t this already exist? +`tinter` just simplifies a task usually done with `grDevices`. It’s +default is to remove black and white from the palette. -```r +``` r tinter("blue") #> [1] "#CCCCFF" "#9999FF" "#6666FF" "#3333FF" "#0000FF" "#0000CC" "#000099" #> [8] "#000065" "#000032" @@ -104,8 +103,7 @@ grDevices::colorRampPalette(colors = c("white", "blue", "black"))(11)[-(c(1, 11) #> [8] "#000065" "#000032" ``` - -```r +``` r tinter("blue", direction = "shades") #> [1] "#0000FF" "#0000CC" "#000099" "#000065" "#000032" @@ -115,9 +113,7 @@ grDevices::colorRampPalette(colors = c("blue", "black"))(6)[-6] #> [1] "#0000FF" "#0000CC" "#000099" "#000065" "#000032" ``` - - -```r +``` r tinter("blue", crop = 2) #> [1] "#9999FF" "#6666FF" "#3333FF" "#0000FF" "#0000CC" "#000099" "#000065" @@ -130,30 +126,32 @@ grDevices::colorRampPalette(colors = c("white", "blue", "black"))(11)[-(c(1:2, 1 ## Installation To install from CRAN -``` -install.packages("tinter") -``` -To install the latest development version from [GitHub](https://github.com/poissonconsulting/tinter) -``` -install.packages("devtools") -devtools::install_github("poissonconsulting/err") -devtools::install_github("poissonconsulting/checkr") -devtools::install_github("poissonconsulting/tinter") -``` + install.packages("tinter") -To install the latest development version from the Poisson drat [repository](https://github.com/poissonconsulting/drat) -``` -install.packages("drat") -drat::addRepo("poissonconsulting") -install.packages("tinter") -``` +To install the latest development version from +[GitHub](https://github.com/poissonconsulting/tinter) + + install.packages("devtools") + devtools::install_github("poissonconsulting/err") + devtools::install_github("poissonconsulting/checkr") + devtools::install_github("poissonconsulting/tinter") + +To install the latest development version from the Poisson drat +[repository](https://github.com/poissonconsulting/drat) + + install.packages("drat") + drat::addRepo("poissonconsulting") + install.packages("tinter") ## Contribution -Please report any [issues](https://github.com/poissonconsulting/tinter/issues). +Please report any +[issues](https://github.com/poissonconsulting/tinter/issues). -[Pull requests](https://github.com/poissonconsulting/tinter/pulls) are always welcome. +[Pull requests](https://github.com/poissonconsulting/tinter/pulls) are +always welcome. -Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). -By participating in this project you agree to abide by its terms. +Please note that this project is released with a [Contributor Code of +Conduct](CONDUCT.md). By participating in this project you agree to +abide by its terms. diff --git a/README_files/figure-gfm/colour-1.png b/README_files/figure-gfm/colour-1.png new file mode 100644 index 0000000..cf05fb0 Binary files /dev/null and b/README_files/figure-gfm/colour-1.png differ diff --git a/README_files/figure-gfm/crop-1.png b/README_files/figure-gfm/crop-1.png new file mode 100644 index 0000000..73bd668 Binary files /dev/null and b/README_files/figure-gfm/crop-1.png differ diff --git a/README_files/figure-gfm/darken-1.png b/README_files/figure-gfm/darken-1.png new file mode 100644 index 0000000..cf39edc Binary files /dev/null and b/README_files/figure-gfm/darken-1.png differ diff --git a/README_files/figure-gfm/plot-1.png b/README_files/figure-gfm/plot-1.png new file mode 100644 index 0000000..1e45e59 Binary files /dev/null and b/README_files/figure-gfm/plot-1.png differ diff --git a/README_files/figure-gfm/steps-1.png b/README_files/figure-gfm/steps-1.png new file mode 100644 index 0000000..4b8ceb1 Binary files /dev/null and b/README_files/figure-gfm/steps-1.png differ diff --git a/README_files/figure-gfm/tinter-1.png b/README_files/figure-gfm/tinter-1.png new file mode 100644 index 0000000..7b44656 Binary files /dev/null and b/README_files/figure-gfm/tinter-1.png differ diff --git a/README_files/figure-gfm/tints-1.png b/README_files/figure-gfm/tints-1.png new file mode 100644 index 0000000..9b5068a Binary files /dev/null and b/README_files/figure-gfm/tints-1.png differ diff --git a/build.R b/build.R index d13fa9f..c623aee 100644 --- a/build.R +++ b/build.R @@ -6,8 +6,6 @@ if(TRUE) { if(file.exists("DESCRIPTION")) unlink("docs", recursive = TRUE) pkgdown::build_site() } -### pkgdown absolute path issue unresolved - this is a workaround so CRAN checks pass -unlink("README_files", recursive = TRUE) -unlink("figure", recursive = TRUE) +# need to resolve pkgdown path issue before submitting to cran for update devtools::check()