# Material Palette Generator

A Python port of the [Official Material Palette Generator](https://m2.material.io/design/color/the-color-system.html#tools-for-picking-colors).
This project reverse-engineers and refactors Google’s original algorithm to generate palette (extracted by [edelstone/material-palette-generator](https://github.com/edelstone/material-palette-generator)) into clean, reusable Python code.
## Features
- Generate full Material Design palettes from a single base hex color
- Produces primary, complementary, analogous and triadic variations
- Shows palette preview in image (`pillow` library required)
- CLI support (`mpg` command)
- MIT Licensed
- No dependencies (pure Python)
## Installation
Clone the repository:
```bash
git clone https://github.com/blacksteel3/material-palette-generator.git
cd material-palette-generator
```
Or install via `pip`:
```bash
pip install material-palettes-generator
```
## Usage
```py
import material_palette_generator as mpg
# generate palette from generic method
palettes = mpg.get_palettes("#E91E63") # optional `types` parameter to specify color types
print(palettes['Primary'])
print(palettes['Complementary'])
print(palettes['Analogous-1'])
print(palettes['Analogous-2'])
print(palettes['Triadic-1'])
print(palettes['Triadic-2'])
# or use specific method for specific type
primary_palette = mpg.get_primary_palette("#E91E63")
print(primary_palette)
# preview any palette (`pillow` library must be installed)
mpg.preview_palettes(primary_palette)
```
## Command Line Interface (CLI)
After installing, you can use the mpg command directly from your terminal:
```bash
# Generate the primary palette
mpg "#3f51b5"
# Output as JSON
mpg "#3f51b5" --json
# Output as CSS
mpg "#3f51b5" --css
# Generate specific types
mpg "#3f51b5" --primary
mpg "#3f51b5" --complementary
mpg "#3f51b5" --analogous
mpg "#3f51b5" --triadic
# Combine multiple flags
mpg "#3f51b5" -p -t --json
# Or get all palettes
mpg "#3f51b5" --all
# Preview palette
mpg "#3f51b5" --show
# See all commands
mpg --help
```
## Credits
- **[Google](www.google.com)** — for creating the Material Design color algorithm
- **[Michael Edelstone](https://github.com/edelstone)** — for extracting the obfuscated JavaScript runtime code
- **[Black Steel](https://github.com/blacksteel3)** — for reverse-engineering, renaming, and porting the algorithm to Python
Raw data
{
"_id": null,
"home_page": null,
"name": "material-palettes-generator",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "material design, color palette, color generator, theming",
"author": null,
"author_email": "Black Steel <unknown.user2135@proton.me>",
"download_url": "https://files.pythonhosted.org/packages/93/89/bcc567ff1d923c1035e2145baddd6d789b08a801202243d51f94b65b0fc1/material_palettes_generator-1.2.1.tar.gz",
"platform": null,
"description": "# Material Palette Generator\n\n\nA Python port of the [Official Material Palette Generator](https://m2.material.io/design/color/the-color-system.html#tools-for-picking-colors). \nThis project reverse-engineers and refactors Google\u2019s original algorithm to generate palette (extracted by [edelstone/material-palette-generator](https://github.com/edelstone/material-palette-generator)) into clean, reusable Python code.\n\n## Features\n- Generate full Material Design palettes from a single base hex color\n- Produces primary, complementary, analogous and triadic variations\n- Shows palette preview in image (`pillow` library required)\n- CLI support (`mpg` command)\n- MIT Licensed\n- No dependencies (pure Python)\n\n## Installation\nClone the repository:\n```bash\ngit clone https://github.com/blacksteel3/material-palette-generator.git\ncd material-palette-generator\n```\n\nOr install via `pip`:\n```bash\npip install material-palettes-generator\n```\n\n## Usage\n```py\nimport material_palette_generator as mpg\n\n# generate palette from generic method\npalettes = mpg.get_palettes(\"#E91E63\") # optional `types` parameter to specify color types\n\nprint(palettes['Primary'])\nprint(palettes['Complementary'])\nprint(palettes['Analogous-1'])\nprint(palettes['Analogous-2'])\nprint(palettes['Triadic-1'])\nprint(palettes['Triadic-2'])\n\n# or use specific method for specific type\nprimary_palette = mpg.get_primary_palette(\"#E91E63\")\nprint(primary_palette)\n\n# preview any palette (`pillow` library must be installed)\nmpg.preview_palettes(primary_palette)\n```\n\n## Command Line Interface (CLI)\nAfter installing, you can use the mpg command directly from your terminal:\n```bash\n# Generate the primary palette\nmpg \"#3f51b5\"\n\n# Output as JSON\nmpg \"#3f51b5\" --json\n\n# Output as CSS\nmpg \"#3f51b5\" --css\n\n# Generate specific types\nmpg \"#3f51b5\" --primary\nmpg \"#3f51b5\" --complementary\nmpg \"#3f51b5\" --analogous\nmpg \"#3f51b5\" --triadic\n\n# Combine multiple flags\nmpg \"#3f51b5\" -p -t --json\n\n# Or get all palettes\nmpg \"#3f51b5\" --all\n\n# Preview palette\nmpg \"#3f51b5\" --show\n\n# See all commands\nmpg --help\n```\n\n## Credits\n- **[Google](www.google.com)** \u2014 for creating the Material Design color algorithm\n- **[Michael Edelstone](https://github.com/edelstone)** \u2014 for extracting the obfuscated JavaScript runtime code\n- **[Black Steel](https://github.com/blacksteel3)** \u2014 for reverse-engineering, renaming, and porting the algorithm to Python\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Generate Material Design color palettes in Python",
"version": "1.2.1",
"project_urls": {
"Bug Tracker": "https://github.com/blacksteel3/material-palette-generator/issues",
"Documentation": "https://github.com/blacksteel3/material-palette-generator#readme",
"Homepage": "https://github.com/blacksteel3/material-palette-generator"
},
"split_keywords": [
"material design",
" color palette",
" color generator",
" theming"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "42ee675e317599b4f51978c28a86ece3864a60dd546b0b6e01e0fdfdcb91d40c",
"md5": "a49a894c08c9f47db3777900d6d82db5",
"sha256": "205b52f53efe5f435e9c058d6eaaf464e1e345c943789e8e17bb0eded3e66723"
},
"downloads": -1,
"filename": "material_palettes_generator-1.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a49a894c08c9f47db3777900d6d82db5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 17405,
"upload_time": "2025-08-21T10:28:57",
"upload_time_iso_8601": "2025-08-21T10:28:57.550267Z",
"url": "https://files.pythonhosted.org/packages/42/ee/675e317599b4f51978c28a86ece3864a60dd546b0b6e01e0fdfdcb91d40c/material_palettes_generator-1.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9389bcc567ff1d923c1035e2145baddd6d789b08a801202243d51f94b65b0fc1",
"md5": "018cb9d57d21a3c1c3caea2935abd077",
"sha256": "0db11f3f0d515d2901933a2afb232456c8f34a52eea50db9e4dcd5e1af62eab3"
},
"downloads": -1,
"filename": "material_palettes_generator-1.2.1.tar.gz",
"has_sig": false,
"md5_digest": "018cb9d57d21a3c1c3caea2935abd077",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 17507,
"upload_time": "2025-08-21T10:28:58",
"upload_time_iso_8601": "2025-08-21T10:28:58.381393Z",
"url": "https://files.pythonhosted.org/packages/93/89/bcc567ff1d923c1035e2145baddd6d789b08a801202243d51f94b65b0fc1/material_palettes_generator-1.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-21 10:28:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "blacksteel3",
"github_project": "material-palette-generator",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "material-palettes-generator"
}