{"id":13712507,"url":"https://github.com/nsgrantham/ggdark","last_synced_at":"2025-10-24T18:55:52.841Z","repository":{"id":54508699,"uuid":"149312054","full_name":"nsgrantham/ggdark","owner":"nsgrantham","description":"Dark mode for ggplot2 themes","archived":false,"fork":false,"pushed_at":"2019-10-10T21:02:53.000Z","size":2795,"stargazers_count":199,"open_issues_count":4,"forks_count":9,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-06T22:38:04.068Z","etag":null,"topics":["darkmode","ggplot2","ggplot2-themes","r","tidyverse","visualization"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nsgrantham.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-18T15:35:43.000Z","updated_at":"2025-03-22T08:13:11.000Z","dependencies_parsed_at":"2022-08-13T18:10:31.911Z","dependency_job_id":null,"html_url":"https://github.com/nsgrantham/ggdark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nsgrantham/ggdark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsgrantham%2Fggdark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsgrantham%2Fggdark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsgrantham%2Fggdark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsgrantham%2Fggdark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nsgrantham","download_url":"https://codeload.github.com/nsgrantham/ggdark/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsgrantham%2Fggdark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280849667,"owners_count":26401812,"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-24T02:00:06.418Z","response_time":73,"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":["darkmode","ggplot2","ggplot2-themes","r","tidyverse","visualization"],"created_at":"2024-08-02T23:01:19.256Z","updated_at":"2025-10-24T18:55:52.798Z","avatar_url":"https://github.com/nsgrantham.png","language":"R","funding_links":[],"categories":["Themes and aesthetics","R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\n```\n\n# ggdark\n\n[![Travis-CI Build Status](https://travis-ci.org/nsgrantham/ggdark.svg?branch=master)](https://travis-ci.org/nsgrantham/ggdark)\n[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/nsgrantham/ggdark?branch=master\u0026svg=true)](https://ci.appveyor.com/project/nsgrantham/ggdark)\n\n## Installation\n\nYou can install ggdark from CRAN with:\n\n```{r cran-installation, eval = FALSE}\ninstall.packages(\"ggdark\")\n```\n\nIf you want the development version, you can install ggdark from GitHub with:\n\n```{r gh-installation, eval = FALSE}\n# install.packages(\"devtools\")\ndevtools::install_github(\"nsgrantham/ggdark\")\n```\n\n## Dark mode for ggplot2\n\n```{r gray, fig.path=\"man/figures/\"}\nlibrary(ggplot2)\n\np \u003c- ggplot(diamonds) + \n  geom_point(aes(carat, price, color = cut)) + \n  scale_y_continuous(label = scales::dollar) +\n  guides(color = guide_legend(reverse = TRUE)) +\n  labs(title = \"Prices of 50,000 round cut diamonds by carat and cut\",\n       x = \"Weight (carats)\",\n       y = \"Price in US dollars\",\n       color = \"Quality of the cut\")\n\np + theme_gray()  # ggplot default\n```\n\n```{r dark-gray, fig.path=\"man/figures/\"}\nlibrary(ggdark)\n\np + dark_theme_gray()  # the dark version\n```\n\n```{r add-element, fig.path=\"man/figures/\"}\n# modify the theme to your liking, as you would in ggplot2\np + dark_theme_gray(base_family = \"Fira Sans Condensed Light\", base_size = 14) + \n  theme(plot.title = element_text(family = \"Fira Sans Condensed\"),\n        plot.background = element_rect(fill = \"grey10\"),\n        panel.background = element_blank(),\n        panel.grid.major = element_line(color = \"grey30\", size = 0.2),\n        panel.grid.minor = element_line(color = \"grey30\", size = 0.2),\n        legend.background = element_blank(),\n        axis.ticks = element_blank(),\n        legend.key = element_blank(),\n        legend.position = c(0.815, 0.27))\n```\n\n## Dark themes\n\nggdark provides dark versions of all themes available in ggplot2:\n\n```{r mtcars, fig.path=\"man/figures/\"}\nmtcars2 \u003c- within(mtcars, {\n  vs \u003c- factor(vs, labels = c(\"V-shaped\", \"Straight\"))\n  am \u003c- factor(am, labels = c(\"Automatic\", \"Manual\"))\n  cyl  \u003c- factor(cyl)\n  gear \u003c- factor(gear)\n})\n\np \u003c- ggplot(mtcars2) +\n  geom_point(aes(wt, mpg, color = gear)) +\n  facet_grid(vs ~ am) +\n  labs(title = \"Fuel economy declines as weight increases\",\n       subtitle = \"(1973-74)\",\n       caption = \"Data from the 1974 Motor Trend US magazine.\",\n       x = \"Weight (1000 lbs)\",\n       y = \"Fuel economy (mpg)\",\n       color = \"Gears\")\n```\n\n```{r all-themes, fig.path=\"man/figures/\"}\np + dark_theme_gray()\np + dark_theme_bw()\np + dark_theme_linedraw()\np + dark_theme_light()  # quite dark\np + dark_theme_dark()  # quite light\np + dark_theme_minimal()\np + dark_theme_classic()\np + dark_theme_void()\n```\n\n## Make your own dark theme\n\nUse`dark_mode` on any theme to create its dark version.\n\n```{r gapminder, fig.path=\"man/figures/\"}\ninvert_geom_defaults()  # change geom defaults back to black\n\nlibrary(gapminder)\n\np \u003c- ggplot(subset(gapminder, continent != \"Oceania\")) +\n  geom_line(aes(year, lifeExp, group = country, color = country), lwd = 1, show.legend = FALSE) + \n  facet_wrap(~ continent) +\n  scale_color_manual(values = country_colors) +\n  labs(title = \"Life expectancy has increased worldwide\")\n```\n\n```{r fivethirtyeight, fig.path=\"man/figures/\"}\n# install.packages(\"ggthemes\")\nlibrary(ggthemes)\n\np + theme_fivethirtyeight()\n```\n\n```{r dark-fivethirtyeight, fig.path=\"man/figures/\"}\np + dark_mode(theme_fivethirtyeight())\n```\n\n```{r reset-defaults}\ninvert_geom_defaults()  # leave the geom defaults how you found them!\n```\n\nHappy plotting! 🖤 \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnsgrantham%2Fggdark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnsgrantham%2Fggdark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnsgrantham%2Fggdark/lists"}