Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/EmilHvitfeldt/prismatic
color manipulation R package Simply and Tidy
https://github.com/EmilHvitfeldt/prismatic
color color-manipulation colour r rstats
Last synced: 3 months ago
JSON representation
color manipulation R package Simply and Tidy
- Host: GitHub
- URL: https://github.com/EmilHvitfeldt/prismatic
- Owner: EmilHvitfeldt
- License: other
- Created: 2019-08-29T04:14:04.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-11-29T20:11:41.000Z (almost 2 years ago)
- Last Synced: 2023-11-20T15:10:48.854Z (12 months ago)
- Topics: color, color-manipulation, colour, r, rstats
- Language: R
- Homepage: https://emilhvitfeldt.github.io/prismatic/
- Size: 2.14 MB
- Stars: 132
- Watchers: 3
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- jimsghstars - EmilHvitfeldt/prismatic - color manipulation R package Simply and Tidy (R)
README
---
output: github_document
---```{r opts, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# prismatic
[![R-CMD-check](https://github.com/EmilHvitfeldt/prismatic/workflows/R-CMD-check/badge.svg)](https://github.com/EmilHvitfeldt/prismatic/actions)
[![Codecov test coverage](https://codecov.io/gh/EmilHvitfeldt/prismatic/branch/main/graph/badge.svg)](https://app.codecov.io/gh/EmilHvitfeldt/prismatic?branch=main)
[![CRAN status](http://www.r-pkg.org/badges/version/prismatic)](https://CRAN.R-project.org/package=prismatic)
[![Downloads](http://cranlogs.r-pkg.org/badges/prismatic)](https://CRAN.R-project.org/package=prismatic)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![DOI](https://zenodo.org/badge/205078698.svg)](https://zenodo.org/record/4420786)The goal of prismatic is to provide color manipulation tools in R, in a intuitive, low-dependency and functional way.
- **intuitive** All the working functions are prefixed with `clr_` (**c**o**l**o**r**) allowing for easy autocompletion.
- **low-dependency** Only depends on [farver](https://github.com/thomasp85/farver).
- **functional** All functions have consistent inputs and outputs and are thus fully pipeable.## Installation
You can install the released version of prismatic from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("prismatic")
```And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("EmilHvitfeldt/prismatic")
```
## ExamplesAll **prismatic** functions returns a `colors` object, which includes a new printing method and plotting method for quickly visualizing the colors.
```{r terraincols, dpi=320}
library(prismatic)
library(magrittr)terrain10 <- terrain.colors(10)
terrain10
terrain_color <- color(terrain10)
terrain_color
plot(terrain_color)
```If [cli](https://github.com/r-lib/cli) is available the print method will do its best to represent the colors.
![](man/figures/sceenshot.png)
```{r plotcols, dpi=320}
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()
```## Related work
This package is hugely inspired by the JavaScript library [Qix-/color](https://github.com/Qix-/color).
## Code of Conduct
Please note that the 'prismatic' project is released with a [Contributor Code of Conduct](https://github.com/EmilHvitfeldt/prismatic/blob/main/CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.