Skip to main content

Extended colors for python

Project description

Python Versions PyPI License Documentation Status

ExColor logo ExColor

Installation

pip install excolor

Extra colormaps (gruvbox and more)

New colormaps: BrBu, BrGn, OrBu, OrGn, PiBu, rtd, artdeco, cyberpunk, synthwave, gruvbox, cobalt, noctis, monokai, oceanic

import excolor

cmap = plt.get_cmap("gruvbox")
cmap

Gruvbox

Generate color palettes

Mode "superellipse" defines the path from black to white. Higher degree produces more vibrant colors.

# Seed color
color = '#458588'

colors = excolor.generate_palette(color, mode='superellipse', power=3)

excolor.show_colors(colors)

['#FFFFFF', '#CFF4F6', '#A7DBDE', '#84C0C3', '#63A3A6', '#458588', '#296568', '#114547', '#002224', '#000000']

# Generate palette for primary CSS colors
primary_colors = excolor.generate_primary_palette(color)

excolor.show_colors(primary_colors)

/* Kumutoto color palette */
:root {
--primary-color-1: #DBFFFF;
--primary-color-2: #BBF0F3;
--primary-color-3: #A0DCDF;
--primary-color-4: #88C6C9;
--primary-color-5: #70B0B3;
--primary-color-6: #599A9C;
--primary-color-7: #438386;
--primary-color-8: #2D6C6F;
--primary-color-9: #175558;
}

# Generate palette for background CSS colors
background_colors = excolor.generate_background_palette(color)

excolor.show_colors(background_colors)

/* Cyprus color palette */
:root {
--background-color-1: #2D6C6F;
--background-color-2: #226063;
--background-color-3: #175558;
--background-color-4: #0D494C;
--background-color-5: #043D3F;
--background-color-6: #003033;
--background-color-7: #002426;
--background-color-8: #001618;
--background-color-9: #00090A;
}

# Generate palette for primary CSS colors
foreground_colors = excolor.generate_foreground_palette(color)

excolor.show_colors(foreground_colors)

/* Blizzard Blue color palette */
:root {
--foreground-color-1: #EDFFFF;
--foreground-color-2: #DBFFFF;
--foreground-color-3: #CAFAFC;
--foreground-color-4: #BBF0F3;
--foreground-color-5: #ADE6E9;
--foreground-color-6: #A0DCDF;
--foreground-color-7: #94D1D4;
--foreground-color-8: #88C6C9;
--foreground-color-9: #7CBBBE;
}

Colorize image

url = "https://github.com/timpyrkov/excolor/blob/master/img/image_bw.png?raw=true"

# Load image from url (image_bw.png from github repository)
img = excolor.load_image(url)

# Show source grayscale image
plt.figure(figsize=(6,6), facecolor="#00000000")
plt.imshow(img)
plt.axis("off")
plt.show()

# Colorize and show image
green, blue = "#CAC94C", "#226063"
img = excolor.colorize_image(url, green, blue)

# Show colorized image
plt.figure(figsize=(6,6), facecolor="#00000000")
plt.imshow(img)
plt.axis("off")
plt.show()

Greyscale image, keep channels

url = "https://github.com/timpyrkov/excolor/blob/master/img/image_color.png?raw=true"

# Load image from url (image_color.png from github repository)
img = excolor.load_image(url)

# Show source image
plt.figure(figsize=(6,6), facecolor="#00000000")
plt.imshow(img)
plt.axis("off")
plt.show()

# Convert to greyscale
greyscaled = excolor.greyscale_image(url)

# Show colorized image
plt.figure(figsize=(6,6), facecolor="#00000000")
plt.imshow(greyscaled)
plt.axis("off")
plt.show()

print("Source image array shape:", np.asarray(img).shape)
print("Greyscaled image array shape:", np.asarray(greyscaled).shape)

Low-polygonal

url = "https://github.com/timpyrkov/excolor/blob/master/img/image_gruvbox.png?raw=true"

# Load image from url (image_color.png from github repository)
img = excolor.load_image(url)

# Show source image
plt.figure(figsize=(6,6), facecolor="#00000000")
plt.imshow(img)
plt.axis("off")
plt.show()

# Convert to low-polygonal image
img = excolor.triangle_wallpaper(img=img, density=30, distortion=0.4, size=(640,480))

# Sjow low-polygonal image
plt.figure(figsize=(6,6), facecolor="#00000000")
plt.imshow(img)
plt.axis("off")
plt.show()

Wallpaper

Draw patches distorted by Perlin noise

img = excolor.perlin_wallpaper("gruvbox", n=5, size=(720, 480))
img

Documentation

https://excolor.readthedocs.io

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

excolor-0.1.0.tar.gz (97.0 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: excolor-0.1.0.tar.gz
  • Upload date:
  • Size: 97.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for excolor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 248beab14f1be2aeef7bd29fadbbd6f06756d1da03ecd2c331ab8034df328134
MD5 b01ccada127ccceda68a2ca57988efc7
BLAKE2b-256 f378f7963afddc475cb39a587a66cf0fc4d0df65c9f1bbc2ee77496dbb5f7cf2

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