{"id":32204330,"url":"https://github.com/alexplatasl/mexicolors","last_synced_at":"2026-07-18T14:13:32.209Z","repository":{"id":56934647,"uuid":"399982222","full_name":"alexplatasl/mexicolors","owner":"alexplatasl","description":"A Mexican politics-inspired color palette generator","archived":false,"fork":false,"pushed_at":"2021-09-17T03:54:12.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-09T19:23:25.430Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexplatasl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-25T23:24:44.000Z","updated_at":"2024-10-21T23:17:08.000Z","dependencies_parsed_at":"2022-08-21T06:50:47.439Z","dependency_job_id":null,"html_url":"https://github.com/alexplatasl/mexicolors","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alexplatasl/mexicolors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexplatasl%2Fmexicolors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexplatasl%2Fmexicolors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexplatasl%2Fmexicolors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexplatasl%2Fmexicolors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexplatasl","download_url":"https://codeload.github.com/alexplatasl/mexicolors/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexplatasl%2Fmexicolors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35620506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-18T02:00:07.223Z","response_time":61,"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":[],"created_at":"2025-10-22T04:54:07.950Z","updated_at":"2026-07-18T14:13:32.203Z","avatar_url":"https://github.com/alexplatasl.png","language":"R","funding_links":[],"categories":["Themes and aesthetics"],"sub_categories":[],"readme":"# `mexicolors`: A Mexican politics-inspired color palette generator\n\nBuilding on Philip Waggoner's approach to designing color palettes in the `amerika` package, the `mexicolors` package offers a variety of a Mexican politics-inspired color palettes for a host of applications both in and out of politics. \n\nPalette options range from only a few colors to several colors, but with discrete and continuous options to offer greatest flexibility to the user. `mexicolors` allows for a range of applications, from mapping brief discrete scales to continuous interpolated arrays including dozens of shades graded from green to red. See below for a list of the palettes followed by a few political and non-political examples.\n\n## Installation\n\n Dev:\n\n```{r }\ndevtools::install_github(\"alexplatasl/mexicolors\")\nlibrary(mexicolors)\n```\n\nCRAN:\n\n```{r }\ninstall.packages(\"mexicolors\")\nlibrary(mexicolors)\n```\n\n## Use\n\nUsers simply supply the name of the desired palette in the main function `mexico_palette()`, along with the number `n` of colors desired from the palette (e.g., only 4 from a 5-color palette), and whether \"continuous\" or \"discrete\" `type` mapping is desired. Semi-transparent colors are supported with `alpha` argument. The order of the colors can be reversed with the `direction` parameter.\n\n## Palettes \n\n1. `morena`: two shades of red and two shades of grey.\n2. `pri`: four colors including green, white, grey, and red.\n3. `pan`: four colors including three shades of blue and one shade of white.\n4. `prd`: five colors including two shades of yellow, one shade of white, and two shades of grey.\n5. `cuatroT`: eight colors including two shades of red, two shades of yellow, two shades of gray, and two shades of green.\n6. `ine`: four colors including whine, mexican pink, grey, and black.\n7. `pvem`: six colors including three shades of green, yellow, red, and black.\n8. `mc`: eight colors including four shades of orange and four shades of gray..\n\n### Displaying each palette\n\n```{r }\nmexico_palette(\"cuatroT\", display = TRUE)\n```\n![](examples/dis_4T.png)\n\n```{r }\nmexico_palette(\"ine\", display = TRUE)\n```\n![](examples/dis_ine.png)\n\n```{r }\nmexico_palette(\"morena\", display = TRUE)\n```\n![](examples/dis_morena.png)\n\n\n```{r }\nmexico_palette(\"pri\", display = TRUE)\n```\n![](examples/dis_pri.png)\n\n\n```{r }\nmexico_palette(\"pan\", display = TRUE)\n```\n![](examples/dis_pan.png)\n\n\n```{r }\nmexico_palette(\"prd\", display = TRUE)\n```\n![](examples/dis_prd.png)\n\n\n```{r }\nmexico_palette(\"pvem\", display = TRUE)\n```\n![](examples/dis_pvem.png)\n\n```{r }\nmexico_palette(\"mc\", display = TRUE)\n```\n![](examples/dis_mc.png)\n\n\n### Interpolating between existing colors based on the palettes using the \"continuous\" `type`\n\n```{r }\nmexico_palette(n = 50, name = \"cuatroT\", type = \"continuous\", display = TRUE)\n```\n![](examples/con_4T.png)\n\n```{r }\nmexico_palette(n = 50, name = \"ine\", type = \"continuous\", display = TRUE)\n```\n![](examples/con_ine.png)\n\n```{r }\nmexico_palette(n = 50, name = \"morena\", type = \"continuous\", display = TRUE)\n```\n![](examples/con_morena.png)\n\n\n```{r }\nmexico_palette(n = 50, name = \"pri\", type = \"continuous\", display = TRUE)\n```\n![](examples/con_pri.png)\n\n\n```{r }\nmexico_palette(n = 50, name = \"pan\", type = \"continuous\", display = TRUE)\n```\n![](examples/con_pan.png)\n\n\n```{r }\nmexico_palette(n = 50, name = \"prd\", type = \"continuous\", display = TRUE)\n```\n![](examples/con_prd.png)\n\n\n```{r }\nmexico_palette(n = 50, name = \"pvem\", type = \"continuous\", display = TRUE)\n```\n![](examples/con_pvem.png)\n\n```{r }\nmexico_palette(n = 50, name = \"mc\", type = \"continuous\", display = TRUE)\n```\n![](examples/con_mc.png)\n\n### Example Political Cases (Discrete and Continuous)\n\n```{r }\nlibrary(tidyverse)\n# Continuous: \"ideology\" on a 100 point scale (hypothetical for demo purposes only)\ndata1 \u003c- data.frame(sample(1:100, 3000, replace=TRUE))\n\ndata1 \u003c- data1 %\u003e%\n  rename(id = sample.1.100..3000..replace...TRUE.) %\u003e%\n  as.data.frame()\n\nggplot(data1, aes(id)) +\n  geom_bar(fill=mexico_palette(n = 100, name = \"cuatroT\", type = \"continuous\")) +\n  labs(x = \"Political Ideology (Liberal - Conservative)\",\n       y = \"Count of Respondents\") +\n  theme_bw()\n```\n![](examples/lev100.png)\n\n\n### Non-Political Cases (5 and 7 level palettes)\n\n```{r }\nlibrary(tidyverse)\n\n# 5-level (discrete) palette\nggplot(diamonds, aes(factor(cut), fill = factor(cut))) +\n  geom_bar() + \n  scale_fill_manual(values = mexico_palette(\"cuatroT\", 5, \"discrete\")) +\n  theme_bw()\n```\n![](examples/lev5.png)\n\n\n```{r }\nlibrary(tidyverse)\n\n# 7-level (discrete) palette\nggplot(diamonds, aes(factor(color), fill = factor(color))) +\n  geom_bar() + \n  scale_fill_manual(values = mexico_palette(\"morena\", 7, \"continuous\")) +\n  theme_bw()\n```\n![](examples/lev7.png)\n\n\n## How do I get `mexicolors`? \n\nWhile the package is available for download at [CRAN](https://CRAN.R-project.org/package=mexicolors), `mexicolors` is stored and developed at this GitHub repository, \u003chttps://github.com/alexplatasl/mexicolors/\u003e, along with an [issue tracker](https://github.com/alexplatasl/mexicolors/issues/) for reporting bugs as well as suggesting package extensions and/or enhancements. In the spirit of open science, any level of interaction with the package is allowed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexplatasl%2Fmexicolors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexplatasl%2Fmexicolors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexplatasl%2Fmexicolors/lists"}