Skip to main content

Color Palettes

Project description

wuncolors

Help manipulate Color objects and use custom Color Palettes.

Basic Usage

ColorPalette Object

Contains a hierachy of colors.

from wuncolors import ColorPalette

palette = ColorPalette.from_toml(full_path="palette_example.toml")
Primary
 - blue(0, 0, 255, 1.0)
 - red(255, 0, 0, 1.0)
Secondary
 - random(100, 56, 1, 1.0)
 - random2(222, 222, 7, 1.0)
Others
 - white(255, 255, 255, 1.0)
from wuncolors import ColorPalette

palette = ColorPalette.from_toml(full_path="palette_example.toml")
blue = palette.get_primary("blue")
red = palette.all_colors("red")

all_primary = palette.get_primary()
all_secondary = palette.get_secondary()

all_colors = palette.all_colors()
print(all_primary)
[blue(0, 0, 255, 1.0), red(255, 0, 0, 1.0)]

Color objects

from wuncolors import Color

blue = Color.from_tuple(name="blue", rgb=(0, 0, 255))

Dynamic Usage

You can create a Palette from scratch and be save using the to_toml() method. Duplicate colors will be ignored if inserted in the same category. Colors are stored as sets in the palette.

from wuncolors import Color, ColorPalette

p = ColorPalette("Example")
p.primary.add(Color.from_tuple("blue", (0, 0, 255)))
p.secondary.add(Color.from_tuple("blue", (0, 0, 255)))
p.others.add(Color.from_tuple("blue", (0, 0, 255)))

p.to_toml("test_palette.toml")
ColorPalette(Example)
    Primary
     - blue(0, 0, 255, 1.0)
    Secondary
     - blue(0, 0, 255, 1.0)
    Others
     - blue(0, 0, 255, 1.0)

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

wuncolors-0.1.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

wuncolors-0.1.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file wuncolors-0.1.2.tar.gz.

File metadata

  • Download URL: wuncolors-0.1.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.0 Darwin/21.6.0

File hashes

Hashes for wuncolors-0.1.2.tar.gz
Algorithm Hash digest
SHA256 db2f98f21c718b6c49e48b2599694cc52ec8c54b696ecb8785567b36d696c4f8
MD5 5908552264605a23332a69eccc1711f0
BLAKE2b-256 3c36134fc946ca4c4f59c12549bf13392f3208d16b33793be77d8f216f7d87ad

See more details on using hashes here.

File details

Details for the file wuncolors-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: wuncolors-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.0 Darwin/21.6.0

File hashes

Hashes for wuncolors-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0da82e0694f738ea1de95055f2d868a58634d537e5385a3c67c82caf6326d351
MD5 dabe683c47c0abd0a0f6656a64b093f9
BLAKE2b-256 44acf908b28fc1be0e617883f848cc02edfad35986bfccbb79b580ccd6429f63

See more details on using hashes here.

Supported by

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