{"id":22669853,"url":"https://github.com/astrobarker/mplcolors","last_synced_at":"2026-03-16T14:06:47.969Z","repository":{"id":45177243,"uuid":"373719297","full_name":"AstroBarker/mplcolors","owner":"AstroBarker","description":"A command-line information tool written in Python 3.x to display matplotlib colors.","archived":false,"fork":false,"pushed_at":"2024-11-09T01:09:00.000Z","size":6437,"stargazers_count":33,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T06:23:35.654Z","etag":null,"topics":["cli","matplotlib","python","python-3","shell","terminal"],"latest_commit_sha":null,"homepage":"","language":"Python","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/AstroBarker.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null}},"created_at":"2021-06-04T04:25:25.000Z","updated_at":"2024-12-30T22:26:06.000Z","dependencies_parsed_at":"2024-05-09T03:22:13.045Z","dependency_job_id":"6282b3e8-0b2f-42a4-bf13-a4cca53db772","html_url":"https://github.com/AstroBarker/mplcolors","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstroBarker%2Fmplcolors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstroBarker%2Fmplcolors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstroBarker%2Fmplcolors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstroBarker%2Fmplcolors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AstroBarker","download_url":"https://codeload.github.com/AstroBarker/mplcolors/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248563039,"owners_count":21125196,"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":["cli","matplotlib","python","python-3","shell","terminal"],"created_at":"2024-12-09T15:41:38.366Z","updated_at":"2025-10-13T13:16:17.466Z","avatar_url":"https://github.com/AstroBarker.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mplcolors\n\n\u003cp align=\"center\"\u003eA command-line information tool written in Python 3.x\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"./LICENSE.md\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-GPL-blue.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nTired of searching \"[matplotlib colors](https://duckduckgo.com/?q=matplotlib+colors\u0026atb=v275-4\u0026ia=web)\" every week/day/hour?\n`mplcolors` is a command-line information tool written in Python 3.x which can display `matplotlib` colors, colorbars, and has a few other useful functions.\nThis uses [matplotlib.colors](https://matplotlib.org/stable/api/colors_api.html) to get color names and RGB values and prints with [ANSI escape sequences](https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences). \nFinally, given a `matplotlib` color or hex value, `mplcolors` can return the RGB color complement, color triad, tetrad, and split color complements.\nIt can be installed and imported as a package to manipulate colors in-situ.\n\nIt can also print all of the built-in colorbars.\n\n\u003cimg src=\"https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fmatplotlib.org%2F2.1.1%2F_images%2Fsphx_glr_named_colors_001.png\u0026f=1\u0026nofb=1\" alt=\"matplotlib colors\" align=\"right\" height=\"240px\"\u003e\n\n# Compatibility\nThe command line interface requires a [terminal with true color support](https://gist.github.com/XVilka/8346728).\nNotably, Mac's Terminal.app does not have this and so the colors cannot be properly displayed.\nI'm not sure that that is a workaround for this. \nOn Mac I suggest switching to a different terminal emulator with more modern support such as [kitty](https://sw.kovidgoyal.net/kitty/), [alacritty](https://alacritty.org/), or [iTerm](https://iterm2.com/).\n\n# Requirements\nYou just need a Python distribution (3.x) with matplotlib and a true color compatible terminal emulator.\n\n# Installation\n## Direct Installation\n1. Clone this repository `git clone https://github.com/AstroBarker/mplcolors.git`.\n2. For the package: run `python -m pip install --user .` \n3. For the CLI: run `make install` inside the top level directory.\n  * __MacOS__ `make PREFIX=/usr/local install`\n\n## OS Packages\n`mplcolors` is hosted on the Arch User Repository.\nOn an Arch-based system, you can do, e.g., \n```shell\nyay -S mplcolors\n```\nwhich gives access to the CLI.\n\nAlternatively, you may create an alias in your shell's rc file (e.g., `~/.bashrc`) such as \n```shell\nalias mplcolors='python /path/to/dir/mplcolors.py'\n```\nalthough this will not install the `man` file.\n\n# Usage (CLI)\n\nAfter installation, you may run\n```shell\nmplcolors\n```\n\nto print the default `matplotlib` colors.\n\nYou may display all of the available [xkcd colors](https://xkcd.com/color/rgb/) by passing the option `-a` or flag `--all`.\n\nTo search for the RGB complement to a given color, use the `-c` or `--complement` flags followed by either a `matplotlib` color or hex.\nIf using a hex value, the \"#\" can be given or withheld.\n\n```shell\nmplcolors -c \"12ab84\"\n```\n\nTo search for colors containing a given string (e.g., \"red\"), then you can run: \n```shell\nmplcolors -s \"red\"\n```\n\nTo display all of the built-in colormaps, use the `-b` flag (\"b\" for \"bars\") or the `--colorbars` option\n\n```shell\nmplcolors -b\n```\n\nYou can display color triads, tetrads, and split complements\n```shell\nmplcolors -t teal # or --triad\nmplcolors -r teal # or --tetrad\nmplcolors -sc teal # or --split\n```\n\n# Usage (package)\n`mplcolors` can be imported and used as a package to support your plotting needs.\nTo enable this, it must be in your `$PYTHONPATH` environment variable.\nCurrently, `mplcolors` may support you by finding:\n- RGB color complement (GetComplement)\n- color triads (GetTriad)\n- color tetrads (GetTetrad)\n- color split complement(GetSplitComplement)\n\nOnce installed, simply\n```python\nfrom mplcolors import mplcolors\nmy_color = \"teal\"\ntriad = mplcolors.GetTriad(my_color)\n```\n\nNote that most functions of relevance here will take either an `mpl` color name (e.g., \"cornflowerblue\") or a hex value. \nRGB and  HSV values are used internally for manipulation.\nReturn types for these functions are always hex values.\n\n# Code Style\nCode linting and formatting is done with [ruff](https://docs.astral.sh/ruff/).\nRules are listed in [ruff.toml](ruff.toml).\n\n# TODO\n - Invert color\n - Some functionality to determine how many columns to print based on temrinal size, namely for the color bars, needs logic updates.\n - Better order printed colors ( they are \"row major,\" we want \"column major\" )\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrobarker%2Fmplcolors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastrobarker%2Fmplcolors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrobarker%2Fmplcolors/lists"}