{"id":13788814,"url":"https://github.com/jaredhuling/jcolors","last_synced_at":"2025-10-21T20:09:01.339Z","repository":{"id":56936878,"uuid":"87322073","full_name":"jaredhuling/jcolors","owner":"jaredhuling","description":"A set of color palettes I like (or can at least tolerate)","archived":false,"fork":false,"pushed_at":"2024-03-28T16:53:25.000Z","size":45195,"stargazers_count":25,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-08T12:55:14.770Z","etag":null,"topics":["color-palettes","data-visualization","ggplot2","r-package","visualization"],"latest_commit_sha":null,"homepage":"https://jaredhuling.github.io/jcolors","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaredhuling.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-04-05T14:53:14.000Z","updated_at":"2023-10-19T00:37:24.000Z","dependencies_parsed_at":"2022-08-21T05:50:57.521Z","dependency_job_id":"d369cc75-3ba4-44dd-8b9d-a192758f7d7d","html_url":"https://github.com/jaredhuling/jcolors","commit_stats":{"total_commits":71,"total_committers":3,"mean_commits":"23.666666666666668","dds":0.295774647887324,"last_synced_commit":"81e72c8dab392d2ba47104a06229b1625e3ac6e2"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/jaredhuling/jcolors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhuling%2Fjcolors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhuling%2Fjcolors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhuling%2Fjcolors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhuling%2Fjcolors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaredhuling","download_url":"https://codeload.github.com/jaredhuling/jcolors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhuling%2Fjcolors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280325344,"owners_count":26311428,"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","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["color-palettes","data-visualization","ggplot2","r-package","visualization"],"created_at":"2024-08-03T21:00:54.038Z","updated_at":"2025-10-21T20:09:01.309Z","avatar_url":"https://github.com/jaredhuling.png","language":"HTML","readme":"---\noutput: github_document\n---\n\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE, fig.path = \"vignettes/readme_figs/\")\n```\n\n# `jcolors` intro \n\n[![version](http://www.r-pkg.org/badges/version/jcolors)](https://cran.r-project.org/package=jcolors)\n\n`jcolors` contains a selection of `ggplot2` color palettes that I like (or can at least tolerate to some degree)\n\n## Installation\n\n\nInstall `jcolors` from GitHub:\n\n```{r, eval = FALSE}\ninstall.packages(\"devtools\")\ndevtools::install_github(\"jaredhuling/jcolors\")\n```\n\nAccess the `jcolors` color palettes with `jcolors()`:\n\n```{r eval = TRUE, message = FALSE, warning = FALSE}\nlibrary(jcolors)\n\njcolors('default')\n\n```\n\n## Display all available palettes\n\n### Discrete palettes\n```{r displayall, fig.height = 8}\ndisplay_all_jcolors()\n```\n\n### Continuous palettes\n```{r contin_example_display, fig.height = 8}\ndisplay_all_jcolors_contin()\n```\n\n# Discrete Color Palettes\n\n## Use with `ggplot2`\n\nNow use `scale_color_jcolors()` with `ggplot2`:\n\n```{r eval = TRUE, message = FALSE, warning = FALSE}\nlibrary(ggplot2)\nlibrary(gridExtra)\n\ndata(morley)\n\npltl \u003c- ggplot(data = morley, aes(x = Run, y = Speed,\ngroup = factor(Expt),\ncolour = factor(Expt))) +\n    geom_line(size = 2) +\n    theme_bw() +\n    theme(panel.background = element_rect(fill = \"grey97\"),\n          panel.border = element_blank(),\n          legend.position = \"bottom\")\n\npltd \u003c- ggplot(data = morley, aes(x = Run, y = Speed,\ngroup = factor(Expt),\ncolour = factor(Expt))) +\n    geom_line(size = 2) +\n    theme_bw() +\n    theme(panel.background = element_rect(fill = \"grey15\"),\n          legend.key = element_rect(fill = \"grey15\"),\n          panel.border = element_blank(),\n          panel.grid.major = element_line(color = \"grey45\"),\n          panel.grid.minor = element_line(color = \"grey25\"),\n          legend.position = \"bottom\")\n\ngrid.arrange(pltl + scale_color_jcolors(palette = \"default\"),\n             pltd + scale_color_jcolors(palette = \"default\"), ncol = 2)\n\ngrid.arrange(pltl + scale_color_jcolors(palette = \"pal2\"),\n             pltd + scale_color_jcolors(palette = \"pal2\"), ncol = 2)\n\n\n\n```\n\nColor palettes can be displayed using `display_jcolors()`\n\n## default\n```{r}\ndisplay_jcolors(\"default\")\n```\n\n## pal2\n```{r}\ndisplay_jcolors(\"pal2\")\n```\n\n## pal3\n```{r}\ndisplay_jcolors(\"pal3\")\n```\n\n## pal4\n```{r}\ndisplay_jcolors(\"pal4\")\n```\n\n## pal5\n```{r}\ndisplay_jcolors(\"pal5\")\n```\n\n## pal6\n```{r}\ndisplay_jcolors(\"pal6\")\n```\n\n## pal7\n```{r}\ndisplay_jcolors(\"pal7\")\n```\n\n## pal8\n```{r}\ndisplay_jcolors(\"pal8\")\n```\n\n## pal9\n```{r}\ndisplay_jcolors(\"pal9\")\n```\n\n## pal10\n```{r}\ndisplay_jcolors(\"pal10\")\n```\n\n## pal11\n```{r}\ndisplay_jcolors(\"pal11\")\n```\n\n## pal12\n```{r}\ndisplay_jcolors(\"pal12\")\n```\n\n## rainbow\n```{r}\ndisplay_jcolors(\"rainbow\")\n```\n\n## More example plots\n\n```{r moreplots}\ngrid.arrange(pltl + scale_color_jcolors(palette = \"pal3\"),\n             pltd + scale_color_jcolors(palette = \"pal3\"), ncol = 2)\n\ngrid.arrange(pltl + scale_color_jcolors(palette = \"pal4\"),\n             pltd + scale_color_jcolors(palette = \"pal4\") + \n                 theme(panel.background = element_rect(fill = \"grey5\")), ncol = 2)\n\ngrid.arrange(pltl + scale_color_jcolors(palette = \"pal5\"),\n             pltd + scale_color_jcolors(palette = \"pal5\"), ncol = 2)\n\n\npltd \u003c- ggplot(data = OrchardSprays, aes(x = rowpos, y = decrease,\ngroup = factor(treatment),\ncolour = factor(treatment))) +\n    geom_line(size = 2) +\n    geom_point(size = 4) +\n    theme_bw() +\n    theme(panel.background = element_rect(fill = \"grey15\"),\n          legend.key = element_rect(fill = \"grey15\"),\n          panel.border = element_blank(),\n          panel.grid.major = element_line(color = \"grey45\"),\n          panel.grid.minor = element_line(color = \"grey25\"),\n          legend.position = \"bottom\")\n\n\npltd + scale_color_jcolors(palette = \"pal6\")\n\n```\n\n\n\n\n\n# Continuous Color Palettes\n\n## Display all continuous palettes\n```{r contin_example, fig.height = 8}\ndisplay_all_jcolors_contin()\n```\n\n\n## Use with `ggplot2`\n\n```{r mountain_ex, fig.height=6}\nset.seed(42)\nplt \u003c- ggplot(data.frame(x = rnorm(10000), y = rexp(10000, 1.5)), aes(x = x, y = y)) +\n      geom_hex() + coord_fixed() + theme(legend.position = \"bottom\")\n\nplt2 \u003c- plt + scale_fill_jcolors_contin(\"pal2\", bias = 1.75) + theme_bw()\nplt3 \u003c- plt + scale_fill_jcolors_contin(\"pal3\", reverse = TRUE, bias = 2.25) + theme_bw()\nplt4 \u003c- plt + scale_fill_jcolors_contin(\"pal12\", reverse = TRUE, bias = 2) + theme_bw()\ngrid.arrange(plt2, plt3, plt4, ncol = 2)\n```\n\n# `ggplot2` themes\n\n```{r diamonds_light_theme, fig.height = 6, message = FALSE, warning = FALSE}\nlibrary(scales)\n\np1 \u003c- ggplot(aes(x = carat, y = price), data = diamonds) + \n      geom_point(alpha = 0.5, size = 1, aes(color = clarity)) +\n      scale_x_continuous(trans = log10_trans(), limits = c(0.2, 3),\n        breaks = c(0.2, 0.5, 1, 2, 3)) + \n      scale_y_continuous(trans = log10_trans(), limits = c(350, 15000),\n        breaks = c(350, 1000, 5000, 10000, 15000)) +\n      ggtitle('Price (log10) by Carat (log10) and Clarity') + \n      scale_color_jcolors(\"rainbow\") +      \n      theme_light_bg()\n\n\np2 \u003c- ggplot(aes(x = carat, y = price), data = diamonds) + \n      geom_point(alpha = 0.5, size = 1, aes(color = cut)) +\n      scale_x_continuous(trans = log10_trans(), limits = c(0.2, 3),\n        breaks = c(0.2, 0.5, 1, 2, 3)) + \n      scale_y_continuous(trans = log10_trans(), limits = c(350, 15000),\n        breaks = c(350, 1000, 5000, 10000, 15000)) +\n      ggtitle('Price (log10) by Carat (log10) and Cut') + \n      scale_color_jcolors(\"pal4\") +  \n      theme_light_bg()\n\ngrid.arrange(p1, p2, ncol = 2)\n```\n\n```{r jitterplot, fig.height = 6, message = FALSE, warning = FALSE}\n\np1 \u003c- ggplot(aes(x = clarity, y = price), data = diamonds) + \n      geom_point(alpha = 0.25, size = 1, position = \"jitter\", aes(color = log(carat + 1))) +\n      scale_y_continuous(trans = log10_trans(), limits = c(350, 15000),\n        breaks = c(350, 1000, 5000, 10000, 15000)) +\n      ggtitle('Price (log10) by Carat (log10) and Clarity')\n        \np2 \u003c- ggplot(aes(x = clarity, y = price), data = diamonds) + \n      geom_point(alpha = 0.25, size = 1, position = \"jitter\", aes(color = log(carat + 1))) +\n      scale_y_continuous(trans = log10_trans(), limits = c(350, 15000),\n        breaks = c(350, 1000, 5000, 10000, 15000)) +\n      ggtitle('Price (log10) by Carat (log10) and Clarity')\n\ngrid.arrange(p1 + scale_color_jcolors_contin(\"pal3\", bias = 1.75) + theme_light_bg(),\n             p2 + scale_color_jcolors_contin(\"rainbow\") + theme_light_bg(), ncol = 2)\n```\n\n\nIf the background here were dark, then this would look nice:\n\n```{r darkbg, warning = FALSE}\ngrid.arrange(p1 + scale_color_jcolors_contin(\"pal3\", bias = 1.75) + theme_dark_bg(),\n             p2 + scale_color_jcolors_contin(\"rainbow\") + theme_dark_bg(), ncol = 2)\n```\n\n\n\n\n","funding_links":[],"categories":["ggplot"],"sub_categories":["Palettes 🎨"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredhuling%2Fjcolors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredhuling%2Fjcolors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredhuling%2Fjcolors/lists"}