knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of prismatic is to provide color manipulation tools in R, in a intuitive, low-dependency and functional way.
clr_
(color) allowing for easy autocompletion.You can install the released version of prismatic from CRAN with:
install.packages("prismatic")
And the development version from GitHub with:
# install.packages("devtools") devtools::install_github("EmilHvitfeldt/prismatic")
All prismatic functions returns a colors
object, which includes a new printing method and plotting method for quickly visualizing the colors.
library(prismatic) library(magrittr) terrain10 <- terrain.colors(10) terrain10 terrain_color <- color(terrain10) terrain_color plot(terrain_color)
If cli is available the print method will do its best to represent the colors.
library(prismatic) library(magrittr) ddd <- color(terrain.colors(10)) ddd plot(ddd) clr_grayscale(ddd) %>% plot() clr_lighten(ddd, 0.7) %>% plot() clr_darken(ddd, 0.5) %>% plot() clr_saturate(ddd, 0.5) %>% plot() clr_desaturate(ddd, 0.5) %>% plot() clr_negate(ddd) %>% plot() clr_rotate(ddd, 180) %>% plot() clr_protan(ddd) %>% plot() clr_tritan(ddd) %>% plot() clr_deutan(ddd) %>% plot()
This package is hugely inspired by the JavaScript library Qix-/color.
Please note that the 'prismatic' project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.