Skip to main content

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 = '#D65D0E'

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

excolor.show_colors(colors)

['#FFFFFF', '#FFEDCC', '#FFCE95', '#FFAA61', '#FD8435', '#D85F10', '#AA3C00', '#751D00', '#390600', '#000000']

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

excolor.show_colors(primary_colors)

/* Pastel Orange color palette */
:root {
--primary-color-1: #FFF8DD;
--primary-color-2: #FFE8B4;
--primary-color-3: #FFCF8B;
--primary-color-4: #FFB266;
--primary-color-5: #FF9547;
--primary-color-6: #F2792A;
--primary-color-7: #D55C0D;
--primary-color-8: #B74000;
--primary-color-9: #942500;
}

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

excolor.show_colors(background_colors)

/* Reddy Brown color palette */
:root {
--background-color-1: #B74000;
--background-color-2: #A63200;
--background-color-3: #942500;
--background-color-4: #801800;
--background-color-5: #6B0D00;
--background-color-6: #540400;
--background-color-7: #3D0000;
--background-color-8: #270000;
--background-color-9: #130000;
}

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

excolor.show_colors(foreground_colors)

/* Circus color palette */
:root {
--foreground-color-1: #FFFCEF;
--foreground-color-2: #FFF8DD;
--foreground-color-3: #FFF2CA;
--foreground-color-4: #FFE8B4;
--foreground-color-5: #FFDC9F;
--foreground-color-6: #FFCF8B;
--foreground-color-7: #FFC078;
--foreground-color-8: #FFB266;
--foreground-color-9: #FFA456;
}

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 image
light, dark = "#FBF1C6", "#665C54"
img = excolor.colorize_image(url, dark, light)

# 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 greyscale 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)

Source image array shape: (240, 320, 3)
Greyscaled image array shape: (240, 320, 3)

Low-polygonal

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

# Load image from url (image_gruvbox.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))

# Show 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

Metadata

Release files for excolor 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for excolor 0.1.1
File Size Uploaded
excolor-0.1.1.tar.gz 97.0 kB Details

Release files / excolor-0.1.1.tar.gz

Download URL excolor-0.1.1.tar.gz
Size 97.0 kB
Tags Source
SHA-256 checksum
How to use checksums
98823819647334ca449770f500abafe22af615ade05215b69eddef17bd63a778
BLAKE2b-256 checksum
How to use checksums
53a3c2f20e826b289f1aa8ac07e86db96df4ce955cba8d3f5bfb95f07ace99af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page