Skip to main content

material-color-palette

Google's original 2014 Material Design color palettes as a Python library package.

Image showing all shades of all colors. Image showing all shades of all colors. Generated with extras/palette_image.py

Original source (scroll down to 2014 Material Design color palettes and expand).

Because I wanted to use the palette in my projects, but didn't want to copy-paste values, and couldn't find an existing implementation that was simple and complete.

Fully type-hinted and with a test suite.

Installation

Install from PyPI, e.g.:

pip install material-color-palette

Usage

>>> from material_color_palette import Color
>>> MY_COLOR = Color("red", 700)
>>> MY_COLOR
Color(name='red', shade=700, rgb=(211, 47, 47))

# Use RGB triplet representation in e.g. pygame/pygame-ce:
>>> MY_COLOR.rgb
(211, 47, 47)

# Use hex string representation in e.g. Matplotlib:
>>> MY_COLOR.hex
'#d32f2f'

# r, g, b properties should cover any other need:
>>> f"r={MY_COLOR.r/255}, g={MY_COLOR.g/255}, b={MY_COLOR.b/255}, a=1.0"
'r=0.8274509803921568, g=0.1843137254901961, b=0.1843137254901961, a=1.0'

# Accent colours use the original notation, so shade value is a string  
>>> Color("pink", "a100")

# You can use strings for non-accented colours too, if you want to be consistent
>>> Color("teal", "100")

# Useful, contextual error messages:
>>> Color("lime_green") 
Traceback (most recent call last):
...
ValueError: 'lime_green' isn't a valid Material color name. Allowed values: 'amber',
'black', 'blue', 'blue gray', 'blue_gray', 'brown', 'cyan', 'deep orange', 'deep purple',
'deep_orange', 'deep_purple', 'gray', 'green', 'indigo', 'light blue', 'light green',
'light_blue', 'light_green', 'lime', 'orange', 'pink', 'purple', 'red', 'teal', 'white',
'yellow'.

>>> Color("lime")
Traceback (most recent call last):
...
ValueError: Shade must be specified for Material color 'lime'.

>>> Color("yellow", 950)
Traceback (most recent call last):
...
ValueError: 950 isn't a valid shade for Material color 'yellow'. Allowed values: 50,
100, 200, 300, 400, 500, 600, 700, 800, 900, 'a100', 'a200', 'a400', 'a700'.


>>> Color("gray", "a200")
Traceback (most recent call last):
...
ValueError: 'a200' isn't a valid shade for Material color 'gray'. Allowed values: 50,
100, 200, 300, 400, 500, 600, 700, 800, 900.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

material_color_palette-1.1.0.post3.tar.gz (111.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

material_color_palette-1.1.0.post3-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file material_color_palette-1.1.0.post3.tar.gz.

File metadata

  • Download URL: material_color_palette-1.1.0.post3.tar.gz
  • Upload date:
  • Size: 111.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for material_color_palette-1.1.0.post3.tar.gz
Algorithm Hash digest
SHA256 c951445884c6e4e87cf3ce4d06581f9fa3bd0116f8d7165377e81c9ab0b7fdc6
MD5 12ad00ad7990dd541fc98fcea87bddf1
BLAKE2b-256 7d560ee1c6755b93491a8f680d8c1392cd9b57969a87c839668dc616dec3c638

See more details on using hashes here.

File details

Details for the file material_color_palette-1.1.0.post3-py3-none-any.whl.

File metadata

  • Download URL: material_color_palette-1.1.0.post3-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for material_color_palette-1.1.0.post3-py3-none-any.whl
Algorithm Hash digest
SHA256 b81a3f02f530e6f97eb5dba0e6ee8120ca47ce426f18940e7196bd5d89138080
MD5 66c09bb17fb2bc107b2977717b364a0c
BLAKE2b-256 8fbf97d86975a93d42c77b26d1b358d96450fbeb883ad57044f102f02ab8d616

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.0.post3 This release

2 files

1.1.0.post2

2 files

1.1.0.post1

2 files

1.1.0

2 files

1.0.0

2 files

0.4.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page