Skip to main content

Define your Python plot style

Project description

Banner

License GitHub last commit Website LinkedIn Medium

My Palette

This package handles user created color palettes scheme to be used in Python plotting libraries (matplotlib, seaborn, etch).

Users can use specific colors in accordance with their taste or company guidelines that are different from the defaults in matplotlib. Therefore, mypalette helps to create, store, and use color palettes.

It can use a text file from https://coolors.co or a list of hexadecimal codes and saves a JSON format, comprising of colors: name, hexadecimal and RGB codes.

Table of contents

Installation

pip install mypalette

Usage

Currently, you can choose two ways to input your palette in mypalette: From coolors.co or as a list of hexadecimal codes

From coolors

Coolors.co is a website designed to generate new palettes, pick palettes from photos, create gradients, etch.

Do download needed, proceed to https://coolors.co, and click "Start the generator" or use this set of colors.

On the top right corner, click on Export -> Code -> Download

This will save a text file named 'palette' on your computer.

Now we can use this file in mypalette:

from mypalette import LoadPalette

palette = LoadPalette()
p = palette.create_new_palette(input_txt='palette.txt', output_json='palette.json')
print(p)

{'HEXs': ['#000000', '#FFFFFF'], 'RGBs': [(0.0, 0.0, 0.0), (1.0, 1.0, 1.0)], 'Names': ['black', 'white']}

Load a compatible JSON file:

p = palette.load_palette(json_path='palette.json')

print(p)
['#000000', '#FFFFFF']

From hexadecimal

Alternatively, you can choose to use a list of hexadecimal codes as your input.

Note, such list can be obtained from the coolors.co/generate url.

p = palette.create_palette_from_hex_list(
    hexadecimal = ['#000000', '#FFFFFF'],
    output_json = 'black_and_white.json')

print(p)
{'HEXs': ['#000000', '#FFFFFF'], 'RGBs': [(0.0, 0.0, 0.0), (1.0, 1.0, 1.0)], 'Names': ['black', 'white']}

Development and Contribute

I welcome contributors (of all experience levels) to improve this package and expand its scope and reach.

If you have never worked on open source project before or you want to brush up your memory here, check out these links:

Please do not hesitate to contact me to report issues or new ideas.

License

Copyright (c) 2020 Mattia Cinelli

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Footer

Project details


Download files

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

Source Distribution

mypalette-1.0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

mypalette-1.0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file mypalette-1.0.1.0.tar.gz.

File metadata

  • Download URL: mypalette-1.0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for mypalette-1.0.1.0.tar.gz
Algorithm Hash digest
SHA256 dfd9b811423a42217d3ba495634949c6443a772ff2def9fa1823f327d31d788f
MD5 457a417f6a2ea14969b557d23a7246f7
BLAKE2b-256 c1b9811b782ce5835f85204e9a2f12c616d8b5ac1bb99a7b9eb4db333d1d62f2

See more details on using hashes here.

Provenance

File details

Details for the file mypalette-1.0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mypalette-1.0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for mypalette-1.0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8d0f3f3b86dfa1778e0063cf3d3230ebbdf2fa27f7ba9b78b58b6468f4c5266
MD5 6e2175181855e57abdb0750e1a35e7c4
BLAKE2b-256 8b711a7937f45f1c0d462c846670bdd3677bb1ce1ffc101624ed727dbc203e99

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page