{"id":13857618,"url":"https://github.com/tesselle/khroma","last_synced_at":"2025-07-13T22:30:34.864Z","repository":{"id":44891788,"uuid":"152768624","full_name":"tesselle/khroma","owner":"tesselle","description":":art: Colour Schemes for Scientific Data Visualization","archived":false,"fork":false,"pushed_at":"2023-12-19T17:43:32.000Z","size":10985,"stargazers_count":194,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2023-12-20T12:29:23.595Z","etag":null,"topics":["accessibility","colour-schemes","data-visualization","r-package"],"latest_commit_sha":null,"homepage":"https://packages.tesselle.org/khroma/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tesselle.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-10-12T15:08:35.000Z","updated_at":"2023-12-29T12:32:56.188Z","dependencies_parsed_at":"2023-12-20T07:56:15.954Z","dependency_job_id":null,"html_url":"https://github.com/tesselle/khroma","commit_stats":{"total_commits":345,"total_committers":5,"mean_commits":69.0,"dds":"0.38550724637681155","last_synced_commit":"b1a185cc2228bee3c4d6b90fa1c1c7d641a1c6d5"},"previous_names":[],"tags_count":16,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tesselle%2Fkhroma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tesselle%2Fkhroma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tesselle%2Fkhroma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tesselle%2Fkhroma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tesselle","download_url":"https://codeload.github.com/tesselle/khroma/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225920420,"owners_count":17545492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accessibility","colour-schemes","data-visualization","r-package"],"created_at":"2024-08-05T03:01:42.093Z","updated_at":"2025-07-13T22:30:34.843Z","avatar_url":"https://github.com/tesselle.png","language":"R","readme":"---\noutput: github_document\nbibliography: vignettes/bibliography.bib\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include=FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = NULL\n)\nSys.setenv(LANGUAGE = \"en\") # Force locale\n```\n\n# khroma \u003cimg width=120px src=\"man/figures/logo.png\" align=\"right\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![status-badge](https://ci.codeberg.org/api/badges/14693/status.svg)](https://ci.codeberg.org/repos/14693){.pkgdown-devel}\n[![Code coverage](https://packages.tesselle.org/khroma/coverage/badge.svg)](https://packages.tesselle.org/khroma/coverage/){.pkgdown-devel}\n[![Dependencies](https://tinyverse.netlify.app/badge/khroma)](https://cran.r-project.org/package=khroma){.pkgdown-devel}\n\n[![r-universe](https://tesselle.r-universe.dev/badges/khroma)](https://tesselle.r-universe.dev/khroma){.pkgdown-devel}\n[![CRAN Version](https://www.r-pkg.org/badges/version/khroma)](https://cran.r-project.org/package=khroma){.pkgdown-release}\n[![CRAN checks](https://badges.cranchecks.info/worst/khroma.svg)](https://cran.r-project.org/web/checks/check_results_khroma.html){.pkgdown-release}\n[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/khroma)](https://cran.r-project.org/package=khroma){.pkgdown-release}\n\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1472077.svg)](https://doi.org/10.5281/zenodo.1472077)\n\u003c!-- badges: end --\u003e\n\n## Overview\n\nColor blindness affects a large number of individuals. When communicating scientific results color palettes must therefore be carefully chosen to be accessible to all readers.\n\nThis R package provides an implementation of @okabe2008, @tol2021 and @crameri2018 color schemes. These schemes are ready for each type of data (qualitative, diverging or sequential), with colors that are distinct for all people, including color-blind readers. This package also provides tools to simulate color-blindness and to test how well the colors of any palette are identifiable. To simulate color-blindness in production-ready R figures you may also be interested in the [**colorblindr**](https://github.com/clauswilke/colorblindr) package.\n\n@tol2021 and @crameri2018 offer carefully chosen schemes, ready for each type of data, with colors that are:\n\n* Distinct for all people, including color-blind readers,\n* Distinct from black and white,\n* Distinct on screen and paper,\n* Matching well together,\n* Citable and reproducible.\n\nSee `vignette(\"tol\")` and `vignette(\"crameri\")` for a more complete overview.\n\nFor specific uses, several scientific thematic schemes (geologic timescale, land cover, FAO soils, etc.) are implemented, but these color schemes may not be color-blind safe.\n\nAll these color schemes are implemented for use with base R **graphics** or [**ggplot2**](https://github.com/tidyverse/ggplot2) and [**ggraph**](https://github.com/thomasp85/ggraph).\n\n---\n\n```{r citation, echo=FALSE, comment='', results='asis'}\ncite \u003c- utils::citation(\"khroma\")\nprint(cite, bibtex = FALSE)\n```\n\n## Installation\n\nYou can install the released version of **khroma** from [CRAN](https://CRAN.R-project.org):\n\n```{r cran-installation, eval=FALSE}\ninstall.packages(\"khroma\")\n```\n\nAnd the development version from [Codeberg](https://codeberg.org/) with:\n\n```{r gh-installation, eval=FALSE}\n# install.packages(\"remotes\")\nremotes::install_git(\"https://codeberg.org/tesselle/khroma\")\n```\n\n## Usage\n\n```{r packages}\n## Install extra packages (if needed)\n# install.packages(\"ggplot2\"))\n\n## Load packages\nlibrary(khroma)\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eAvailable palettes\u003c/strong\u003e (click to expand)\u003c/summary\u003e\n\n```{r info}\n## Get a table of available palettes\ninfo()\n```\n\n\u003c/details\u003e\n\n### Color palettes and scales\n\n`color()` returns a function that when called with a single integer argument returns a vector of colors.\n\n```{r usage}\n## Paul Tol's bright color scheme\nbright \u003c- color(\"bright\")\nbright(7)\n```\n\n```{r usage-show, fig.height=2, fig.width=7, fig.align='center'}\n## Plot the color scheme\nplot_scheme(bright(7), colours = TRUE)\n```\n\n```{r usage-plot, fig.height=3.5, fig.width=5, fig.align='center'}\ndata(mpg, package = \"ggplot2\")\n\n## Use with graphics\npar(mar = c(5, 4, 1, 1) + 0.1)\nplot(\n  x = mpg$displ,\n  y = mpg$hwy,\n  pch = 16,\n  col = palette_color_picker(\"bright\")(mpg$class),\n  xlab = \"displ\",\n  ylab = \"hwy\",\n  panel.first = grid(),\n  las = 1\n)\n\n## Use with ggplot2\nggplot2::ggplot(data = mpg) +\n  ggplot2::aes(x = displ, y = hwy, color = class) +\n  ggplot2::geom_point() +\n  ggplot2::theme_bw() +\n  scale_color_bright()\n```\n\n### Diagnostic tools\n#### Test how well the colors are identifiable\n\n```{r usage-map, fig.height=2, fig.width=7, fig.align='center'}\n## Okabe \u0026 Ito's color scheme\nokabe \u003c- color(\"okabe ito\")\n\nset.seed(12345)\nplot_map(okabe(8))\n```\n\n```{r usage-tiles, fig.height=3, fig.width=3, fig.align='center'}\n## BuRd sequential color scheme\nBuRd \u003c- color(\"BuRd\")\n\nplot_tiles(BuRd(128), n = 256)\n```\n\n#### Simulate color-blindness\n\n```{r usage-colorblind1, echo=FALSE, eval=FALSE, fig.height=2, fig.width=7, fig.align='center'}\n## change() returns function\ndeuteranopia \u003c- change(okabe, mode = \"deuteranopia\")\nplot_scheme(deuteranopia(8), colours = TRUE)\n\nprotanopia \u003c- change(okabe, mode = \"protanopia\")\nplot_scheme(protanopia(8), colours = TRUE)\n\ntritanopia \u003c- change(okabe, mode = \"tritanopia\")\nplot_scheme(tritanopia(8), colours = TRUE)\n\nachromatopsia \u003c- change(okabe, mode = \"achromatopsia\")\nplot_scheme(achromatopsia(8), colours = TRUE)\n```\n\n```{r usage-colorblind2, fig.height=4, fig.width=7, fig.align='center'}\nplot_scheme_colorblind(okabe(8))\n\n## ggplot2 default color scheme\n## (equally spaced hues around the color wheel)\nx \u003c- scales::hue_pal()(8)\nplot_scheme_colorblind(x)\n```\n\n## Contributing\n\nPlease note that the **khroma** project is released with a [Contributor Code of Conduct](https://www.tesselle.org/conduct.html). By contributing to this project, you agree to abide by its terms.\n\n## References\n\n```{r metadata, include=FALSE}\n## Update codemeta.json\ncodemetar::write_codemeta(verbose = FALSE)\n\n## Update CITATION.cff\ncff_keys \u003c- list(\n  identifiers = list(\n    list(description = \"The concept DOI.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.1472077\"),\n    list(description = \"The versioned DOI for version 1.0.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.1472078\"),\n    list(description = \"The versioned DOI for version 1.1.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.2577258\"),\n    list(description = \"The versioned DOI for version 1.1.1.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.2635680\"),\n    list(description = \"The versioned DOI for version 1.1.2.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.3237015\"),\n    list(description = \"The versioned DOI for version 1.1.3.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.3239344\"),\n    list(description = \"The versioned DOI for version 1.2.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.3371615\"),\n    list(description = \"The versioned DOI for version 1.3.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.3519838\"),\n    list(description = \"The versioned DOI for version 1.4.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.4067906\"),\n    list(description = \"The versioned DOI for version 1.4.1.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.4612091\"),\n    list(description = \"The versioned DOI for version 1.5.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.4723613\"),\n    list(description = \"The versioned DOI for version 1.6.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.4947109\"),\n    list(description = \"The versioned DOI for version 1.7.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.5388239\"),\n    list(description = \"The versioned DOI for version 1.8.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.5886699\"),\n    list(description = \"The versioned DOI for version 1.9.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.6659769\"),\n    list(description = \"The versioned DOI for version 1.10.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.7838382\"),\n    list(description = \"The versioned DOI for version 1.11.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.8269306\"),\n    list(description = \"The versioned DOI for version 1.12.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.10470003\"),\n    list(description = \"The versioned DOI for version 1.13.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.12606781\"),\n    list(description = \"The versioned DOI for version 1.14.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.13378711\"),\n    list(description = \"The versioned DOI for version 1.15.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.14629064\"),\n    list(description = \"The versioned DOI for version 1.16.0.\",\n         type = \"doi\",\n         value = \"10.5281/zenodo.14927198\"),\n    list(description = \"The CRAN DOI\",\n         type = \"doi\",\n         value = \"10.32614/cran.package.khroma\")\n  )\n)\ncff \u003c- cffr::cff_create(\"DESCRIPTION\", keys = cff_keys)\nif (cffr::cff_validate(cff)) cffr::cff_write(cff, outfile = \"CITATION.cff\")\n```\n","funding_links":[],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftesselle%2Fkhroma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftesselle%2Fkhroma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftesselle%2Fkhroma/lists"}