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: about 18 hours 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 (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-11-18T19:43:12.000Z (about 1 month ago)
- Last Synced: 2024-12-13T15:46:42.873Z (9 days ago)
- Topics: color, color-manipulation, colour, r, rstats
- Language: R
- Homepage: https://emilhvitfeldt.github.io/prismatic/
- Size: 5.65 MB
- Stars: 138
- Watchers: 4
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
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 an 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** function return a `colors` object, which includes a new printing method and plotting method for quickly visualizing the colors.
```{r terraincols, dpi=320}
library(prismatic)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}
ddd <- color(terrain.colors(10))
dddplot(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.