diff --git a/NEWS.md b/NEWS.md index 2eae1cc..90f0934 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,5 @@ # tinter 0.1.0 -* Added exported functions chk_color/chk_colour and vld_color/vld_colour. -* Resolved issue of 'class(matrix(...)) gives a vector of length two and conditions of length -greater than one in 'if' or 'while' give an error'. +* Added exported functions `chk_color`/`chk_colour` and `vld_color`/`vld_colour`. +* Resolved issue in r devel build caused by testing condition on vector of length two. diff --git a/R/vld.R b/R/vld.R index 0e8b2bb..23b4acd 100644 --- a/R/vld.R +++ b/R/vld.R @@ -5,7 +5,7 @@ #' #' @inheritParams chk::chk_true #' @return A flag indicating whether the object was validated. -#' @seealso \code{\link{chk_color}()} +#' @seealso [chk_color()] #' @name vld_color NULL diff --git a/README.Rmd b/README.Rmd index 44f3ac6..de908a0 100644 --- a/README.Rmd +++ b/README.Rmd @@ -36,7 +36,6 @@ knitr::opts_chunk$set( ```{r global} library(tinter) hex <- "#335CAC" - ``` ```{r colour, echo = FALSE, fig.width = 2, fig.height = 0.5} @@ -81,7 +80,6 @@ tinter(hex, direction = "tints") ```{r tints, echo=FALSE} tinter_plot(tinter(hex, direction = "tints")) - ``` ```{r, results="hide"} @@ -117,7 +115,7 @@ library(sf) nc <- st_read(system.file(package = "sf", "shape/nc.shp")) ggplot(data = nc) + - geom_sf(aes(fill = AREA), colour = "white", lwd = 0.05) + + geom_sf(aes(fill = AREA), colour = "white", lwd = 0.04) + # colours from tinter scale_fill_gradientn(colours = tinter(hex)) + theme_void() + diff --git a/README.md b/README.md index 36a7976..b5ca3bd 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ library(sf) nc <- st_read(system.file(package = "sf", "shape/nc.shp")) ggplot(data = nc) + - geom_sf(aes(fill = AREA), colour = "white", lwd = 0.05) + + geom_sf(aes(fill = AREA), colour = "white", lwd = 0.04) + # colours from tinter scale_fill_gradientn(colours = tinter(hex)) + theme_void() + diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..f8be9b0 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,156 @@ + + + + + + + + +Page not found (404) • tinter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + +Content not found. Please use links in the navbar. + +
+ + + +
+ + + + +
+ + + + + + + + diff --git a/docs/CODE_OF_CONDUCT.html b/docs/CODE_OF_CONDUCT.html index 8727d7b..9d6bfe3 100644 --- a/docs/CODE_OF_CONDUCT.html +++ b/docs/CODE_OF_CONDUCT.html @@ -8,21 +8,36 @@ Contributor Code of Conduct • tinter + + + + + + + + - + - - + + + + + + + - + + - + - - + + + @@ -30,10 +45,10 @@ - + - + @@ -47,9 +62,10 @@ + - +
@@ -71,7 +87,7 @@ -
+
@@ -117,22 +133,32 @@

Contributor Code of Conduct

+ + + + + diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 449bacf..d380ab4 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -8,21 +8,36 @@ License • tinter + + + + + + + + - + - - + + + + + + + - + + - + - - + + + @@ -30,10 +45,10 @@ - + - + @@ -47,9 +62,10 @@ + - +
@@ -71,7 +87,7 @@ -
+
@@ -111,22 +127,32 @@

License

+ + + + + diff --git a/docs/LICENSE.html b/docs/LICENSE.html index 4657e9e..3d17ef7 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -8,21 +8,36 @@ MIT License • tinter + + + + + + + + - + - - + + + + + + + - + + - + - - + + + @@ -30,10 +45,10 @@ - + - + @@ -47,9 +62,10 @@ + - +
@@ -71,7 +87,7 @@ -
+
@@ -108,29 +124,39 @@

MIT License

Copyright (c) 2018 Poisson Consulting Ltd.

-

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

+

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

-

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ + + + + diff --git a/docs/apple-touch-icon-120x120.png b/docs/apple-touch-icon-120x120.png new file mode 100644 index 0000000..c512856 Binary files /dev/null and b/docs/apple-touch-icon-120x120.png differ diff --git a/docs/apple-touch-icon-152x152.png b/docs/apple-touch-icon-152x152.png new file mode 100644 index 0000000..2941d4f Binary files /dev/null and b/docs/apple-touch-icon-152x152.png differ diff --git a/docs/apple-touch-icon-180x180.png b/docs/apple-touch-icon-180x180.png new file mode 100644 index 0000000..a9016a5 Binary files /dev/null and b/docs/apple-touch-icon-180x180.png differ diff --git a/docs/apple-touch-icon-60x60.png b/docs/apple-touch-icon-60x60.png new file mode 100644 index 0000000..fe8a2e6 Binary files /dev/null and b/docs/apple-touch-icon-60x60.png differ diff --git a/docs/apple-touch-icon-76x76.png b/docs/apple-touch-icon-76x76.png new file mode 100644 index 0000000..d5fe7c0 Binary files /dev/null and b/docs/apple-touch-icon-76x76.png differ diff --git a/docs/apple-touch-icon.png b/docs/apple-touch-icon.png new file mode 100644 index 0000000..bba3a50 Binary files /dev/null and b/docs/apple-touch-icon.png differ diff --git a/docs/authors.html b/docs/authors.html index ee3ca0c..f2212bd 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -8,21 +8,36 @@ Authors • tinter + + + + + + + + - + - - + + + + + + + - + + - + - - + + + @@ -30,10 +45,10 @@ - + - + @@ -47,9 +62,10 @@ + - +
@@ -71,7 +87,7 @@ -
+
@@ -111,7 +127,7 @@

Authors

  • -

    Joe Thorley. Contributor. ORCID +

    Joe Thorley. Contributor.

  • @@ -121,19 +137,23 @@

    Authors

    + + + diff --git a/docs/bootstrap-toc.css b/docs/bootstrap-toc.css new file mode 100644 index 0000000..5a85941 --- /dev/null +++ b/docs/bootstrap-toc.css @@ -0,0 +1,60 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ + +/* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ + +/* All levels of nav */ +nav[data-toggle='toc'] .nav > li > a { + display: block; + padding: 4px 20px; + font-size: 13px; + font-weight: 500; + color: #767676; +} +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 19px; + color: #563d7c; + text-decoration: none; + background-color: transparent; + border-left: 1px solid #563d7c; +} +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 18px; + font-weight: bold; + color: #563d7c; + background-color: transparent; + border-left: 2px solid #563d7c; +} + +/* Nav: second level (shown on .active) */ +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} +nav[data-toggle='toc'] .nav .nav > li > a { + padding-top: 1px; + padding-bottom: 1px; + padding-left: 30px; + font-size: 12px; + font-weight: normal; +} +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 29px; +} +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 28px; + font-weight: 500; +} + +/* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ +nav[data-toggle='toc'] .nav > .active > ul { + display: block; +} diff --git a/docs/bootstrap-toc.js b/docs/bootstrap-toc.js new file mode 100644 index 0000000..1cdd573 --- /dev/null +++ b/docs/bootstrap-toc.js @@ -0,0 +1,159 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ +(function() { + 'use strict'; + + window.Toc = { + helpers: { + // return all matching elements in the set, or their descendants + findOrFilter: function($el, selector) { + // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ + // http://stackoverflow.com/a/12731439/358804 + var $descendants = $el.find(selector); + return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); + }, + + generateUniqueIdBase: function(el) { + var text = $(el).text(); + var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); + return anchor || el.tagName.toLowerCase(); + }, + + generateUniqueId: function(el) { + var anchorBase = this.generateUniqueIdBase(el); + for (var i = 0; ; i++) { + var anchor = anchorBase; + if (i > 0) { + // add suffix + anchor += '-' + i; + } + // check if ID already exists + if (!document.getElementById(anchor)) { + return anchor; + } + } + }, + + generateAnchor: function(el) { + if (el.id) { + return el.id; + } else { + var anchor = this.generateUniqueId(el); + el.id = anchor; + return anchor; + } + }, + + createNavList: function() { + return $(''); + }, + + createChildNavList: function($parent) { + var $childList = this.createNavList(); + $parent.append($childList); + return $childList; + }, + + generateNavEl: function(anchor, text) { + var $a = $(''); + $a.attr('href', '#' + anchor); + $a.text(text); + var $li = $('
  • '); + $li.append($a); + return $li; + }, + + generateNavItem: function(headingEl) { + var anchor = this.generateAnchor(headingEl); + var $heading = $(headingEl); + var text = $heading.data('toc-text') || $heading.text(); + return this.generateNavEl(anchor, text); + }, + + // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). + getTopLevel: function($scope) { + for (var i = 1; i <= 6; i++) { + var $headings = this.findOrFilter($scope, 'h' + i); + if ($headings.length > 1) { + return i; + } + } + + return 1; + }, + + // returns the elements for the top level, and the next below it + getHeadings: function($scope, topLevel) { + var topSelector = 'h' + topLevel; + + var secondaryLevel = topLevel + 1; + var secondarySelector = 'h' + secondaryLevel; + + return this.findOrFilter($scope, topSelector + ',' + secondarySelector); + }, + + getNavLevel: function(el) { + return parseInt(el.tagName.charAt(1), 10); + }, + + populateNav: function($topContext, topLevel, $headings) { + var $context = $topContext; + var $prevNav; + + var helpers = this; + $headings.each(function(i, el) { + var $newNav = helpers.generateNavItem(el); + var navLevel = helpers.getNavLevel(el); + + // determine the proper $context + if (navLevel === topLevel) { + // use top level + $context = $topContext; + } else if ($prevNav && $context === $topContext) { + // create a new level of the tree and switch to it + $context = helpers.createChildNavList($prevNav); + } // else use the current $context + + $context.append($newNav); + + $prevNav = $newNav; + }); + }, + + parseOps: function(arg) { + var opts; + if (arg.jquery) { + opts = { + $nav: arg + }; + } else { + opts = arg; + } + opts.$scope = opts.$scope || $(document.body); + return opts; + } + }, + + // accepts a jQuery object, or an options object + init: function(opts) { + opts = this.helpers.parseOps(opts); + + // ensure that the data attribute is in place for styling + opts.$nav.attr('data-toggle', 'toc'); + + var $topContext = this.helpers.createChildNavList(opts.$nav); + var topLevel = this.helpers.getTopLevel(opts.$scope); + var $headings = this.helpers.getHeadings(opts.$scope, topLevel); + this.helpers.populateNav($topContext, topLevel, $headings); + } + }; + + $(function() { + $('nav[data-toggle="toc"]').each(function(i, el) { + var $nav = $(el); + Toc.init($nav); + }); + }); +})(); diff --git a/docs/favicon-16x16.png b/docs/favicon-16x16.png new file mode 100644 index 0000000..64bbb3c Binary files /dev/null and b/docs/favicon-16x16.png differ diff --git a/docs/favicon-32x32.png b/docs/favicon-32x32.png new file mode 100644 index 0000000..b0f467e Binary files /dev/null and b/docs/favicon-32x32.png differ diff --git a/docs/favicon.ico b/docs/favicon.ico new file mode 100644 index 0000000..29121c7 Binary files /dev/null and b/docs/favicon.ico differ diff --git a/docs/index.html b/docs/index.html index 1fe7a84..9a9e4d2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,20 +6,27 @@ Generate a Monochromatic Palette • tinter - - - + + + + + + + + + + + - - -
    + +
    -
    - - - - +
    +
    -

    lifecycle Travis build status AppVeyor build status Coverage status License: MIT CRAN status CRAN Downloads

    +

    Introduction

    tinter provides a simple way to generate monochromatic palettes. Easily define:

      -
    • palette direction (“shades”, “tints”, or “both”).
    • +
    • 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).
    • +
    • 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).
    - -

    - -

    -
    tinter(hex, direction = "tints")
    -

    -
    tinter(hex, steps = 10)
    -

    -
    tinter(hex, steps = 10, crop = 7)
    -

    -
    tinter(hex, steps = 10, crop = 7, adjust = 0.4)
    -

    +
    library(tinter)
    +hex <- "#335CAC"
    +

    +
    tinter(hex)
    +#> [1] "#D6DEEE" "#ADBDDD" "#849DCD" "#5B7CBC" "#335CAC" "#284989" "#1E3767"
    +#> [8] "#142444" "#0A1222"
    +

    +
    tinter(hex, direction = "tints")
    +

    +
    tinter(hex, steps = 10)
    +

    +
    tinter(hex, steps = 10, crop = 7)
    +

    +
    tinter(hex, steps = 10, crop = 7, adjust = 0.4)
    +

    Create a choropleth map

    -
    library(ggplot2)
    -library(sf)
    -
    -nc <- st_read(system.file(package = "sf", "shape/nc.shp"))
    -
    -ggplot(data = nc) +
    -  geom_sf(aes(fill = AREA), colour = "white", lwd = 0.05) +
    -  # colours from tinter
    -  scale_fill_gradientn(colours = tinter(hex)) +
    -  theme_void() +
    -  coord_sf(datum = NA)
    -

    +
    library(ggplot2)
    +library(sf)
    +
    +nc <- st_read(system.file(package = "sf", "shape/nc.shp"))
    +
    +ggplot(data = nc) +
    +  geom_sf(aes(fill = AREA), colour = "white", lwd = 0.05) +
    +  # colours from tinter
    +  scale_fill_gradientn(colours = tinter(hex)) +
    +  theme_void() +
    +  coord_sf(datum = NA)
    +

    -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.

    +
    tinter("blue")
    +#> [1] "#CCCCFF" "#9999FF" "#6666FF" "#3333FF" "#0000FF" "#0000CC" "#000099"
    +#> [8] "#000065" "#000032"
    +
    +### ------ is identical to
    +
    +grDevices::colorRampPalette(colors = c("white", "blue", "black"))(11)[-(c(1, 11))]
    +#> [1] "#CCCCFF" "#9999FF" "#6565FF" "#3232FF" "#0000FF" "#0000CB" "#000098"
    +#> [8] "#000065" "#000032"
    +
    tinter("blue", direction = "shades")
    +#> [1] "#0000FF" "#0000CC" "#000099" "#000065" "#000032"
    +
    +### --- is identical to
    +
    +grDevices::colorRampPalette(colors = c("blue", "black"))(6)[-6]
    +#> [1] "#0000FF" "#0000CC" "#000099" "#000065" "#000032"
    +
    tinter("blue", crop = 2)
    +#> [1] "#9999FF" "#6666FF" "#3333FF" "#0000FF" "#0000CC" "#000099" "#000065"
    +
    +### --- is identical to
    +
    +grDevices::colorRampPalette(colors = c("white", "blue", "black"))(11)[-(c(1:2, 10:11))]
    +#> [1] "#9999FF" "#6565FF" "#3232FF" "#0000FF" "#0000CB" "#000098" "#000065"

    Installation

    -

    To install from CRAN

    -
    install.packages("tinter")
    -

    To install the latest development version from GitHub

    -
    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

    -
    install.packages("drat")
    -drat::addRepo("poissonconsulting")
    -install.packages("tinter")
    +

    To install the latest release from CRAN

    +
    install.packages("tinter")
    +

    To install the developmental version from GitHub

    +
    # install.packages("remotes")
    +remotes::install_github("poissonconsulting/tinter")
    +

    To install the latest developmental release from the Poisson drat repository

    +
    # install.packages("drat")
    +drat::addRepo("poissonconsulting")
    +install.packages("tinter")

    @@ -173,13 +174,13 @@

    - @@ -210,12 +227,14 @@

    Developers

    -

    Site built with pkgdown 1.3.0.

    +

    Site built with pkgdown 1.5.0.

    + + diff --git a/docs/index_files/figure-html/colour-1.png b/docs/index_files/figure-html/colour-1.png deleted file mode 100644 index 780ceb8..0000000 Binary files a/docs/index_files/figure-html/colour-1.png and /dev/null differ diff --git a/docs/index_files/figure-html/crop-1.png b/docs/index_files/figure-html/crop-1.png deleted file mode 100644 index 886d07b..0000000 Binary files a/docs/index_files/figure-html/crop-1.png and /dev/null differ diff --git a/docs/index_files/figure-html/darken-1.png b/docs/index_files/figure-html/darken-1.png deleted file mode 100644 index 6d7c0b3..0000000 Binary files a/docs/index_files/figure-html/darken-1.png and /dev/null differ diff --git a/docs/index_files/figure-html/plot-1.png b/docs/index_files/figure-html/plot-1.png deleted file mode 100644 index 9b966cc..0000000 Binary files a/docs/index_files/figure-html/plot-1.png and /dev/null differ diff --git a/docs/index_files/figure-html/steps-1.png b/docs/index_files/figure-html/steps-1.png deleted file mode 100644 index 9ac3474..0000000 Binary files a/docs/index_files/figure-html/steps-1.png and /dev/null differ diff --git a/docs/index_files/figure-html/tinter-1.png b/docs/index_files/figure-html/tinter-1.png deleted file mode 100644 index aec35fd..0000000 Binary files a/docs/index_files/figure-html/tinter-1.png and /dev/null differ diff --git a/docs/index_files/figure-html/tints-1.png b/docs/index_files/figure-html/tints-1.png deleted file mode 100644 index b76f68b..0000000 Binary files a/docs/index_files/figure-html/tints-1.png and /dev/null differ diff --git a/docs/logo.png b/docs/logo.png index cc81d16..8b7ce6a 100644 Binary files a/docs/logo.png and b/docs/logo.png differ diff --git a/docs/news/index.html b/docs/news/index.html index ce0a052..0aa1f16 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -8,21 +8,36 @@ Changelog • tinter + + + + + + + + - + - - + + + + + + + - + + - + - - + + + @@ -30,10 +45,10 @@ - + - + @@ -47,9 +62,10 @@ + - +
    @@ -71,7 +87,7 @@ -
    +
    -

    +

    tinter 0.0.1 2018-12-16

    • Added a NEWS.md file to track changes to the package.
    +
    +
    +

    +tinter 0.1.0 Unreleased +

    +
      +
    • Added exported functions chk_color/chk_colour and vld_color/vld_colour.
    • +
    • Resolved issue in r devel build caused by testing condition on vector of length two.
    • +
    - +
    + + diff --git a/docs/pkgdown.css b/docs/pkgdown.css index c03fb08..c01e592 100644 --- a/docs/pkgdown.css +++ b/docs/pkgdown.css @@ -17,12 +17,14 @@ html, body { height: 100%; } +body { + position: relative; +} + body > .container { display: flex; height: 100%; flex-direction: column; - - padding-top: 60px; } body > .container .row { @@ -69,6 +71,10 @@ summary { margin-top: calc(-60px + 1em); } +dd { + margin-left: 3em; +} + /* Section anchors ---------------------------------*/ a.anchor { @@ -102,37 +108,135 @@ a.anchor { margin-top: -40px; } -/* Static header placement on mobile devices */ -@media (max-width: 767px) { - .navbar-fixed-top { - position: absolute; - } - .navbar { - padding: 0; - } +/* Navbar submenu --------------------------*/ + +.dropdown-submenu { + position: relative; } +.dropdown-submenu>.dropdown-menu { + top: 0; + left: 100%; + margin-top: -6px; + margin-left: -1px; + border-radius: 0 6px 6px 6px; +} + +.dropdown-submenu:hover>.dropdown-menu { + display: block; +} + +.dropdown-submenu>a:after { + display: block; + content: " "; + float: right; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + border-width: 5px 0 5px 5px; + border-left-color: #cccccc; + margin-top: 5px; + margin-right: -10px; +} + +.dropdown-submenu:hover>a:after { + border-left-color: #ffffff; +} + +.dropdown-submenu.pull-left { + float: none; +} + +.dropdown-submenu.pull-left>.dropdown-menu { + left: -100%; + margin-left: 10px; + border-radius: 6px 0 6px 6px; +} /* Sidebar --------------------------*/ -#sidebar { +#pkgdown-sidebar { margin-top: 30px; + position: -webkit-sticky; + position: sticky; + top: 70px; } -#sidebar h2 { + +#pkgdown-sidebar h2 { font-size: 1.5em; margin-top: 1em; } -#sidebar h2:first-child { +#pkgdown-sidebar h2:first-child { margin-top: 0; } -#sidebar .list-unstyled li { +#pkgdown-sidebar .list-unstyled li { margin-bottom: 0.5em; } +/* bootstrap-toc tweaks ------------------------------------------------------*/ + +/* All levels of nav */ + +nav[data-toggle='toc'] .nav > li > a { + padding: 4px 20px 4px 6px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; +} + +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 5px; + color: inherit; + border-left: 1px solid #878787; +} + +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 5px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; + border-left: 2px solid #878787; +} + +/* Nav: second level (shown on .active) */ + +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} + +nav[data-toggle='toc'] .nav .nav > li > a { + padding-left: 16px; + font-size: 1.35rem; +} + +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 15px; +} + +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 15px; + font-weight: 500; + font-size: 1.35rem; +} + +/* orcid ------------------------------------------------------------------- */ + .orcid { - height: 16px; + font-size: 16px; + color: #A6CE39; + /* margins are required by official ORCID trademark and display guidelines */ + margin-left:4px; + margin-right:4px; vertical-align: middle; } @@ -222,6 +326,19 @@ a.sourceLine:hover { visibility: visible; } +/* headroom.js ------------------------ */ + +.headroom { + will-change: transform; + transition: transform 200ms linear; +} +.headroom--pinned { + transform: translateY(0%); +} +.headroom--unpinned { + transform: translateY(-100%); +} + /* mark.js ----------------------------*/ mark { @@ -234,3 +351,17 @@ mark { .html-widget { margin-bottom: 10px; } + +/* fontawesome ------------------------ */ + +.fab { + font-family: "Font Awesome 5 Brands" !important; +} + +/* don't display links in code chunks when printing */ +/* source: https://stackoverflow.com/a/10781533 */ +@media print { + code a:link:after, code a:visited:after { + content: ""; + } +} diff --git a/docs/pkgdown.js b/docs/pkgdown.js index eb7e83d..7e7048f 100644 --- a/docs/pkgdown.js +++ b/docs/pkgdown.js @@ -2,18 +2,11 @@ (function($) { $(function() { - $("#sidebar") - .stick_in_parent({offset_top: 40}) - .on('sticky_kit:bottom', function(e) { - $(this).parent().css('position', 'static'); - }) - .on('sticky_kit:unbottom', function(e) { - $(this).parent().css('position', 'relative'); - }); + $('.navbar-fixed-top').headroom(); - $('body').scrollspy({ - target: '#sidebar', - offset: 60 + $('body').css('padding-top', $('.navbar').height() + 10); + $(window).resize(function(){ + $('body').css('padding-top', $('.navbar').height() + 10); }); $('[data-toggle="tooltip"]').tooltip(); diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 135582e..83a4426 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,5 +1,6 @@ pandoc: '2.4' -pkgdown: 1.3.0 +pkgdown: 1.5.0 pkgdown_sha: ~ articles: [] +last_built: 2020-04-16T18:44Z diff --git a/docs/reference/chk_color.html b/docs/reference/chk_color.html new file mode 100644 index 0000000..da78fbf --- /dev/null +++ b/docs/reference/chk_color.html @@ -0,0 +1,208 @@ + + + + + + + + +Check Color String — chk_color • tinter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Checks that x is a string (non-missing character vector of length 1) +that specifies a color.

    +

    chk_color +checks if a color string.

    +

    chk_colour +checks if a color string.

    +
    + +
    chk_color(x, x_name = NULL)
    +
    +chk_colour(x, x_name = NULL)
    + +

    Arguments

    + + + + + + + + + + +
    x

    The object to check.

    x_name

    A string of the name of object x or NULL.

    + +

    Value

    + +

    NULL, invisibly. Called for the side effect of throwing an error +if the condition is not met.

    +

    Functions

    + + +
      +
    • chk_color: Check Color String Object

    • +
    • chk_colour: Check Color String Object

    • +
    +

    See also

    + + + +

    Examples

    +
    +# chk_color +chk_color("blue") +try(chk_color("glue"))
    #> Error in FALSE : `"glue"` must be a valid color.
    +# chk_colour +chk_colour("blue") +try(chk_colour("glue"))
    #> Error in FALSE : `"glue"` must be a valid color.
    +
    + +
    + + + +
    + + + + + + + + diff --git a/docs/reference/darken.html b/docs/reference/darken.html index 2b3f910..75b9c83 100644 --- a/docs/reference/darken.html +++ b/docs/reference/darken.html @@ -8,21 +8,36 @@ Darken colour. — darken • tinter + + + + + + + + - + - - + + + + + + + - + + - + - - + + + @@ -30,12 +45,11 @@ - + - - + @@ -49,9 +63,10 @@ + - +
    @@ -73,7 +88,7 @@ -
    +
    @@ -110,13 +125,11 @@

    Darken colour.

    -

    Darken colour.

    -
    darken(x, amount)
    - +

    Arguments

    @@ -129,42 +142,39 @@

    Arg

    A number from 0 to 1.

    - +

    Value

    A vector of modified colours.

    -

    Examples

    darken(tinter("blue"), 0.2)
    #> [1] "#A5A5CE" "#7B7BCE" "#5252CE" "#2929CE" "#0000CE" "#0000A5" "#00007B" #> [8] "#000051" "#000028"
    - + + + diff --git a/docs/reference/figures/logo.png b/docs/reference/figures/logo.png index cc81d16..8b7ce6a 100644 Binary files a/docs/reference/figures/logo.png and b/docs/reference/figures/logo.png differ diff --git a/docs/reference/index.html b/docs/reference/index.html index c6ea857..0e0cf0b 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -8,21 +8,36 @@ Function reference • tinter + + + + + + + + - + - - + + + + + + + - + + - + - - + + + @@ -30,10 +45,10 @@ - + - + @@ -47,9 +62,10 @@ + - +
    @@ -71,7 +87,7 @@ -
    +
    @@ -120,8 +136,19 @@

    + + + + + + +

    chk_color() chk_colour()

    + +

    Check Color String

    + +

    darken()

    @@ -138,32 +165,41 @@

    tinter()

    Generate shades, tints or both from a colour.

    + + + +

    vld_color() vld_colour()

    + +

    Validate Color String

    - + + + diff --git a/docs/reference/lighten.html b/docs/reference/lighten.html index 0d1d1f7..bc4ac0b 100644 --- a/docs/reference/lighten.html +++ b/docs/reference/lighten.html @@ -8,21 +8,36 @@ Lighten colour. — lighten • tinter + + + + + + + + - + - - + + + + + + + - + + - + - - + + + @@ -30,12 +45,11 @@ - + - - + @@ -49,9 +63,10 @@ + - +
    @@ -73,7 +88,7 @@ -
    +
    @@ -110,13 +125,11 @@

    Lighten colour.

    -

    Lighten colour.

    -
    lighten(x, amount)
    - +

    Arguments

    @@ -129,42 +142,39 @@

    Arg

    A number from 0 to 1.

    - +

    Value

    A vector of modified colours.

    -

    Examples

    lighten(tinter("blue"), 0.2)
    #> [1] "#F5F5FF" "#EBEBFF" "#E1E1FF" "#D8D8FF" "#CECEFF" "#CECEF5" "#CECEEB" #> [8] "#CECEE1" "#CECED8"
    - + + + diff --git a/docs/reference/tinter.html b/docs/reference/tinter.html index 1c9820f..f6630af 100644 --- a/docs/reference/tinter.html +++ b/docs/reference/tinter.html @@ -8,21 +8,36 @@ Generate shades, tints or both from a colour. — tinter • tinter + + + + + + + + - + - - + + + + + + + - + + - + - - + + + @@ -30,12 +45,11 @@ - + - - + @@ -49,9 +63,10 @@ + - +
    @@ -73,7 +88,7 @@ -
    +
    @@ -110,13 +125,11 @@

    Generate shades, tints or both from a colour.

    -

    Generate shades, tints or both from a colour.

    -
    tinter(x, steps = 5, crop = 1, direction = "both", adjust = 0)
    - +

    Arguments

    @@ -141,11 +154,10 @@

    Arg

    A number between -1 and 1. Values between 0 and -1 increasingly darken colour; values between 0 and 1 increasingly lighten colour.

    - +

    Value

    A vector of colours.

    -

    Examples

    tinter("blue")
    #> [1] "#CCCCFF" "#9999FF" "#6666FF" "#3333FF" "#0000FF" "#0000CC" "#000099" @@ -153,32 +165,30 @@

    Examp #> [8] "#FA6A5C" "#E15F52" "#C85449" "#AF4A40" "#953F37" "#7D352E" "#632A24" #> [15] "#4A1F1B"

    tinter("#fa6a5c", direction = "tints")
    #> [1] "#FEE1DE" "#FDC3BD" "#FBA59D" "#FB877C" "#FA6A5C"
    - + + + diff --git a/docs/reference/vld_color.html b/docs/reference/vld_color.html new file mode 100644 index 0000000..278fe8a --- /dev/null +++ b/docs/reference/vld_color.html @@ -0,0 +1,193 @@ + + + + + + + + +Validate Color String — vld_color • tinter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Validates whether x is a string (non-missing character vector of length 1) +that specifies a color.

    +
    + +
    vld_color(x)
    +
    +vld_colour(x)
    + +

    Arguments

    + + + + + + +
    x

    The object to check.

    + +

    Value

    + +

    A flag indicating whether the object was validated.

    +

    Functions

    + + +
      +
    • vld_color: Validate Color String

    • +
    • vld_colour: Validate Colour String

    • +
    +

    See also

    + + + +

    Examples

    +
    +# vld_color +vld_color("blue")
    #> [1] TRUE
    vld_color("glue")
    #> [1] FALSE
    +# vld_color +vld_colour("blue")
    #> [1] TRUE
    vld_colour("glue")
    #> [1] FALSE
    +
    + +
    + + + +
    + + + + + + + + diff --git a/man/figures/logo.png b/man/figures/logo.png index cc81d16..8b7ce6a 100644 Binary files a/man/figures/logo.png and b/man/figures/logo.png differ diff --git a/man/vld_color.Rd b/man/vld_color.Rd index 4094a41..496f04b 100644 --- a/man/vld_color.Rd +++ b/man/vld_color.Rd @@ -37,5 +37,5 @@ vld_colour("blue") vld_colour("glue") } \seealso{ -\code{\link{chk_color}()} +\code{\link[=chk_color]{chk_color()}} } diff --git a/pkgdown/favicon/apple-touch-icon-120x120.png b/pkgdown/favicon/apple-touch-icon-120x120.png new file mode 100644 index 0000000..c512856 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-120x120.png differ diff --git a/pkgdown/favicon/apple-touch-icon-152x152.png b/pkgdown/favicon/apple-touch-icon-152x152.png new file mode 100644 index 0000000..2941d4f Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-152x152.png differ diff --git a/pkgdown/favicon/apple-touch-icon-180x180.png b/pkgdown/favicon/apple-touch-icon-180x180.png new file mode 100644 index 0000000..a9016a5 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-180x180.png differ diff --git a/pkgdown/favicon/apple-touch-icon-60x60.png b/pkgdown/favicon/apple-touch-icon-60x60.png new file mode 100644 index 0000000..fe8a2e6 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-60x60.png differ diff --git a/pkgdown/favicon/apple-touch-icon-76x76.png b/pkgdown/favicon/apple-touch-icon-76x76.png new file mode 100644 index 0000000..d5fe7c0 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-76x76.png differ diff --git a/pkgdown/favicon/apple-touch-icon.png b/pkgdown/favicon/apple-touch-icon.png new file mode 100644 index 0000000..bba3a50 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon.png differ diff --git a/pkgdown/favicon/favicon-16x16.png b/pkgdown/favicon/favicon-16x16.png new file mode 100644 index 0000000..64bbb3c Binary files /dev/null and b/pkgdown/favicon/favicon-16x16.png differ diff --git a/pkgdown/favicon/favicon-32x32.png b/pkgdown/favicon/favicon-32x32.png new file mode 100644 index 0000000..b0f467e Binary files /dev/null and b/pkgdown/favicon/favicon-32x32.png differ diff --git a/pkgdown/favicon/favicon.ico b/pkgdown/favicon/favicon.ico new file mode 100644 index 0000000..29121c7 Binary files /dev/null and b/pkgdown/favicon/favicon.ico differ diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index e69de29..8b13789 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -0,0 +1 @@ + diff --git a/tools/README-colour-1.png b/tools/README-colour-1.png index a46cabc..cf05fb0 100644 Binary files a/tools/README-colour-1.png and b/tools/README-colour-1.png differ diff --git a/tools/README-crop-1.png b/tools/README-crop-1.png index 0c96a8c..73bd668 100644 Binary files a/tools/README-crop-1.png and b/tools/README-crop-1.png differ diff --git a/tools/README-darken-1.png b/tools/README-darken-1.png index 2e3dc9f..cf39edc 100644 Binary files a/tools/README-darken-1.png and b/tools/README-darken-1.png differ diff --git a/tools/README-plot-1.png b/tools/README-plot-1.png index 0e90a61..ee65871 100644 Binary files a/tools/README-plot-1.png and b/tools/README-plot-1.png differ diff --git a/tools/README-steps-1.png b/tools/README-steps-1.png index 3bbb89b..4b8ceb1 100644 Binary files a/tools/README-steps-1.png and b/tools/README-steps-1.png differ diff --git a/tools/README-tinter-1.png b/tools/README-tinter-1.png index 16e0806..7b44656 100644 Binary files a/tools/README-tinter-1.png and b/tools/README-tinter-1.png differ diff --git a/tools/README-tints-1.png b/tools/README-tints-1.png index 93feb55..9b5068a 100644 Binary files a/tools/README-tints-1.png and b/tools/README-tints-1.png differ