• Stars
    star
    502
  • Rank 87,851 (Top 2 %)
  • Language
    Python
  • License
    GNU Affero Genera...
  • Created over 1 year ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Recolor icon packs, themes, wallpapers and assets with a few clicks or lines of code.

Color Manager

Showcase | Examples | Performance | Roadmap | Requests | Contribute

Color Manager is a program for recoloring and manipulating existing icon packs, themes and wallpapers. The program is designed for NovaOS (Linux) and is written in python. If you publish anything that was generated using this program, make sure to credit the original creator and this repository.

Showcase

Below are examples of what can be done using this library. Using it in a simple python script, you can define a pipeline to automatically customize assets exactly as you see fit.

Icon-pack Recoloring and Editing

gui

Add customizable backdrops to all your icons.

Examples rounding=0.0 rounding=0.5 rounding=1.0
padding=0
color="#000000"
padding=2
color="#112288"
padding=4
color="#551144"

Theme-pack Recoloring

In these examples, my own theme and icon-pack have been recolored for inspiration. These are available for download under releases.

NovaOS-nord Nord NovaOS-woodland Woodland NovaOS-beach Beach
More theme recoloring examples
1 2
3 4

These are simple monochromatic recolors of my own theme and the papirus icon pack. Multichromatic recoloring based on a palette or mapping also works. Recoloring works on any svg/css/png/jpg/xml-based theme, which include GTK-, Cinnamon-, Gnome-shell- and metacity-themes.

Wallpaper Recoloring

Operation Result
Original 1
Monochrome:
(0.6,0.54,0.5)
2
Multichrome:
nord.json
smooth=false
3
Multichrome:
nord.json
smooth=true
4
Remapping:
renord.json
Remap of previous
to alterate nord
colors.
5
Extraction:
Original num=10
6

GUI

The program is also available with a graphical frontend. Features for this may lack slightly behind. demo

Examples

Either import utils into your own script and call its functions, e.g.:

from color_manager import utils

Recoloring collections:

src     = "test/graphics" # Also try "test/theme"
name    = "my_pack"
dest    = "~/Downloads"
color   = (0.5, 0.5, 0.5) # = rc.norm_hsl(180, 50, 50)
palette = "palettes/nord.json"
mapping = "mappings/renord.json"

utils.recolor(src, dest, name, color) # Either color, palette, or mapping.

Extracting color palette:

image      = "test/graphics/imgs/lake_cabin.png" # Also try an svg.
num_colors = 10 # May be any number.
output     = "resources/palette.png" # Optional - saves colors as image.

utils.extract_colors(image, num_colors, output)

Adding backdrops to svg icons:

src      = "test/graphics"
name     = "my_pack"
dest     = "~/Downloads"
color    = "#000000" # Optional - Defaults to black.
padding  = 0   # Optional - Between backdrop and edge.
rounding = 0.5 # Optional - Between 0 and 1, i.e. rectangle and ellipse.

utils.add_backdrop(src, dest, name, color, padding, rounding)

Or launch the GUI by running python3 color_manager/gui.py in a terminal from the project's root directory. The GUI will adopt your active theme. Dependencies: colormath, tqdm and pillow. For the GUI, pygobject (GTK bindings) must also be installed.

Defining a palette or mapping is either done as a dict-object or as an external json-file, e.g.:

my_palette = {
    "type": "palette",
    "name": "...",
    "desc": "...",
    "smooth": True,
    "colors": [
        "#ffffff",
        "#000000",
        ...
    ]
}
my_mapping = {
    "type": "mapping",
    "name": "...",
    "desc": "...",
    "smooth": True,
    "map": {
        "#ffffff": "#000000",
        "#f0f0f0": "#0f0f0f",
        ...
    }
}

Examples of both as json-files are available in this repository.

Performance

Currently, three operations are supported:

Type Result Speed Support
Monochrome
recoloring
A monochromatic variant, colored by appropriate shades of the provided base color. ~5000svg/s
~500png/s
svg, xml, css, png, jpg
Palette
recoloring
A multichromatic variant, where all colors are replaced by their nearest perceived equivalent that adheres to the provided color palette. ~100svg/s
~3png/s
svg, xml, css, png, jpg
Color
remapping
A multichromatic variant, where all colors that are specified in a given map will be replaced as dictated by said map. ~1000svg/s
~10png/s
svg, xml, css, png, jpg
Extract
colors
Returns and optionally saves the color palette of an image, in specified detail. ~10colors/s svg, xml, css, png, jpg
Add
backdrop
Add a rectangular or elliptical background (and anything in between) to all svg icons. ~5000svg/s svg

Speeds were recorded with an Intel i7-4770K CPU and is strongly dependent on file sizes. Any asset can serve as the base for any color palette or base color. Svg/css recolorings will always be perfect, but png/jpgs may require experimentation.

Tip: To increase the quality, i.e. decrease the perceived noise of multichromatic recolorings of pngs/jpgs, either...

  • Increase the number of colors in the palette you provide to the program, e.g. populate it with slight variations of the existing colors
  • Decrease the number of colors in your original image, e.g. using a function like Image.quantize() from pillow.
  • Experiment with setting smooth to true/false in the palette json file.

Roadmap

  • Basic framework for manipulating icon packs.
  • Grayscale, monochromatic and multichromatic recoloring functions.
  • Command-line interface.
  • Graphical user interface based on the GTK framework.
  • Python pip package.
  • Full support for pngs and jpgs.
  • Generate palette from source image or svg.
  • Remove metadata from svgs.
  • Adding basic geometry to the backgrounds of svg icons.
  • Preserve transparency in pngs after multichrome recoloring.
  • Add function to remap colors directly using a json dictionary.
  • Update GUI to support new features.
  • Support inline palette and mapping objects.
  • Basic framework for manipulating GTK, Cinnamon and Metacity themes.
  • Optional automatic palette extending.
  • Intelligent color inversion.
  • GNU/Linux binary (deb, flatpak, appimage).

Requests

Until the release official release of Color Manager, I will be taking requests for recolorings. Simply submit a feature request, specifying what you would like to see. Please star the repository or consider donating, and I will upload your requested variant. Also consider showing the creators of the original artworks some love.

Contribute

If you are experienced with packaging projects such as this for easy distribution, i.e. as deb, appimage or flatpaks, please contact me.


Legal Notice: This repository, including any and all of its forks and derivatives, may NOT be used in the development or training of any machine learning model of any kind, without the explicit permission of the owner of the original repository.

More Repositories

1

Obsidian-academic-export

Turn your obsidian notes into academic papers.
CSS
271
star
2

LiX

Compose papers, dissertations, textbooks, novels, newspapers etc. quicker using abstractions to the standard LaTeX document classes - or create your own classes easily.
TeX
184
star
3

Draw-io-ECE

Custom-made draw.io-shapes - in the form of an importable library - for drawing circuits and conceptual drawings in draw.io.
146
star
4

NovaOS

Minimal remake of the Linux Mint operating system.
80
star
5

NovaOS-nord-Theme

A theme for Linux desktops.
CSS
64
star
6

NovaOS-nord-Icons

Monochromatic icons following the main nord color palette.
60
star
7

ELABorate

A pure symbolic circuit analyzer.
MATLAB
35
star
8

OpenTinyHome

A repository for free-and-open-source tiny-house blueprints.
18
star
9

VAE_based_segmentation

Exploring variational-autoencoder-based semantic segmentation for analyzing CT-scans.
Jupyter Notebook
16
star
10

nv-dark-syntax

A dark, minimalist syntax theme, that is consistent across multiple languages
Less
5
star
11

Animated_SVGs

Examples of animated vector graphics
4
star
12

NicklasVraa

3
star
13

cv_tracking

Repository for code that accompanies our final report for the course "Computer Vision, spring 2023" at AU
Python
3
star
14

Robotics

A repository for robotics-related code.
Python
2
star
15

cv_object_detection

Repository for computer vision project.
Python
2
star
16

configs

Some of my config files.
Shell
2
star
17

AU-LibreOffice-Templates

A repository of LibreOffice templates for presentations and documents using the style guidelines set by Aarhus University.
1
star