Extended colors for python
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file excolor-0.1.1.tar.gz.
File metadata
- Download URL: excolor-0.1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98823819647334ca449770f500abafe22af615ade05215b69eddef17bd63a778
|
|
| MD5 |
1512a08ca3ea6b113454012867f40ddd
|
|
| BLAKE2b-256 |
53a3c2f20e826b289f1aa8ac07e86db96df4ce955cba8d3f5bfb95f07ace99af
|