Skip to main content

Manage color palettes and utilities for working with colors

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.0.tar.gz (4.1 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.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wuncolors-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.5 Darwin/21.6.0

File hashes

Hashes for wuncolors-0.1.0.tar.gz
Algorithm Hash digest
SHA256 350ee80884641ed0cd4f4a7ee2ee293a002685c3a103d1bd9cd5917b6d7084d9
MD5 85975c9bd608f7baa0b5d5515cc9c9f3
BLAKE2b-256 a0f7eeef2e7a13408f424d8c91dddbf0396926e2c610da505064af065abe347a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wuncolors-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.5 Darwin/21.6.0

File hashes

Hashes for wuncolors-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3557eaaac9bbe0044134a2fb02588f57b2d2972b8c7f219b27717d4808571dda
MD5 768fb15aa4dbdaa57599561d7d8aa1b8
BLAKE2b-256 21a56da2a03084042f6217c1ece53b91ab2269a9485986246d5e067ee5841457

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