Skip to main content

A color palette generator

Project description


PaletteSnap

Generate readable color palettes from any image!

Static Badge PyPI - Python Version PyPI - Version Pepy Total Downlods

The README file gives you a "snap" of PaletteSnap. Consult the Wiki for more detailed information.

Installation

PaletteSnap is a python program, so Python is needed. It can be installed via pip:

pip install palettesnap

It is not recommended to install PaletteSnap via the Github repository due to changes that may or may not break. Wait for new releases, and download them via pip.

Note that PaletteSnap depends on many dependencies, and it might take a while for it to execute during its first run.

Demonstration

https://github.com/user-attachments/assets/5afe9fac-1e76-48cf-af2e-3f04894dfc3a

Examples

Features

  • Generates a color palette from any image.
  • Color palette are guaranteed to be readable with good contrast.
  • Options to increase color variety for palette. Useful for monochromatic images.
  • Assigned color roles. No more guessing which color does want with the palette.
  • Sets wallpaper to your image automatically.
  • Uses templates so that you can apply the color palette to your entire system.
  • Has caching so you can load pre-generated palettes fast.
  • Supports program refreshing. No more closing and reopening programs to get them to update their palette.
  • Auto checks for updates. Get notified when a new version gets released.

Comparison

Here is a table that compares PaletteSnap with pywal:

pywal PaletteSnap
Palette Generation :white_check_mark: :white_check_mark:
Wallpaper Setting :white_check_mark: :white_check_mark:
Templating :white_check_mark: :white_check_mark:
Readable Palette :warning: :white_check_mark:
Preview Palette :white_check_mark: :white_check_mark:
Assigned Color Roles :x: :white_check_mark:
Color Variety Options :x: :white_check_mark:
Refreshes Programs :x: :white_check_mark:
Custom Background Color :white_check_mark: :warning:
Cached colorschemes :white_check_mark: :white_check_mark:
Color palette modes :warning: :white_check_mark:
Random palette :white_check_mark: :white_check_mark:
Update Checker :x: :white_check_mark:

Wallpaper Setting

PaletteSnap's functionality is supported by all OS that has Python. However, the wallpaper switching functionality may not be supported for certain OS. Here is a list of all OS that PaletteSnap's wallpaper switching supports:

  • macOS (tested)
  • GNOME Linux (untested)
  • KDE Plasma Linux (tested)
  • XFCE Linux (untested)
  • MATE Linux (untested)

If you have one of the untested OS, and it works, please let me know. If you have an OS that is not on the list, feel free to suggest it!

Usage

When generating the palette, PaletteSnap creates two folders. They are

  • XDG_CONFIG_HOME/palsnap
  • XDG_CACHE_HOME/palsnap

On a macOS, they are ~/.config/palsnap/ and ~/.cache/palsnap/. The folders palsnap can be found in are the same folders pywal's config and cache are found in.

For the sake of convenience, the locations of these folders will be referred to as macOs's in the rest of the README file.

Palette Generation

To generate a palette, run the following command: palsnap gen <img_path> This is the simplest way to generate a palette. If you run palsnap gen -h, you'll notice there is a list of options.

If you keep hitting the manual optimization for your generated palette, this is usually a sign that your current options are not good. If you haven't already, an easy way to avoid it is to set your mode to either light or dark instead of auto.

See Palette Generation for further information.

Preview

In order to preview a palette, you must first generate it. You can skip all the other steps in the process by running palsnap gen <img_path> --skip. After that, run palsnap preview to preview the palette. The output will be the image (only for certain terminals) and all the colors. Your terminal window must be big enough to see all the colors.

If you want a more direct approach, in the ~/.cache/palsnap folder, there should be a PaletteTest.html. You can use it to see what your palette will actually look like if you use it.

See Previewing for further information.

Templating

All templating information is done in ~/.config/palsnap/templates.toml and templates are stored in the templates folder found at ~/.config/palsnap/templates/.

See Templating for further information.

Caching

To save time, it is possible to cache palettes. You can either cache palettes as you generate them with the --cache option, or you can cache the palette right after generating it with:

palsnap cache set <name>

The latter method is useful if you want to generate and preview the palette before caching it. There are many other cache commands like load, clear, rename, etc.

See Caching for further information.

Color Palette

Based on Everforest's palette usage,

Identifier Usages
bg Default Background
bg1 Unused
bg2 Unused
bg3 Comment color
bg4 Selection background color
bg5 Unused
foreground Default Foreground, [Treesitter: Constants, Variables, Function Parameters, Properties, Symbol Identifiers]
red Conditional Keywords, Loop Keywords, Exception Keywords, Inclusion Keywords, Uncategorised Keywords, Diff Deleted Signs, Error Messages, Error Signs
orange Operator Keywords, Operators, Labels, Storage Classes, Composite Types, Enumerated Types, Tags, Title, Debugging Statements
yellow Types, Special Characters, Warning Messages, Warning Signs, [Treesitter: Modules, Namespaces]
green Function Names, Method Names, Strings, Characters, Hint Messages, Hint Signs, Search Highlights, [Treesitter: Constructors, Function Calls, Built-In Functions, Macro Functions, String Escapes, Regex Literals, Tag Delimiters, Non-Structured Text]
cyan Constants, Macros, [Treesitter: Strings, Characters]
blue Identifiers, Uncategorised Special Symbols, Diff Changed Text Background, Info Messages, Info Signs, [Treesitter: Fields, Special Punctuation, Math Environments]
magenta Booleans, Numbers, Preprocessors, [Treesitter: Built-In Constants, Built-In Variables, Macro-Defined Constants, Attributes/Annotations]
violet Unused. Can be used to replace magenta if wanted.
white ANSI white
black ANSI black

cusor_bg is usually just the foreground. cursor_fg is usually just the background.

See Color Roles for further information.

To Do

  • Add option for users to define number of bg gradients.
  • Add more flexibility to determine bg.
  • Add check for templating that returns list of variables not replaced.
  • Add wallpaper setting support for more Linux distributions.
  • Add image preview support for more terminals.

Acknowledgments

  • pywal for the inspiration that led me to create PaletteSnap.
  • Contributors in pull requests for adding or fixing features.
  • ozwaldorf for helpful suggestions and advice during PaletteSnap's initial development. Check out lutgen, a program that themes any image to a desktop colorscheme.
  • Everforest colorscheme for its colorscheme usage.
  • Solarized and Selenized colorschemes for giving me valuable insights on what a palette should be like.

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

palettesnap-1.1.0.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

palettesnap-1.1.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file palettesnap-1.1.0.tar.gz.

File metadata

  • Download URL: palettesnap-1.1.0.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.6.0

File hashes

Hashes for palettesnap-1.1.0.tar.gz
Algorithm Hash digest
SHA256 58c583bb727b95d53b883a0c97b125de64b931578b680dc48a78bae9edaa6709
MD5 0cf479e927524da9d0d0f7d6da847704
BLAKE2b-256 77800a852ab086c92bb90bd9b84678c6ecaa8a1168f3a6a0abaa63f8246441c1

See more details on using hashes here.

File details

Details for the file palettesnap-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: palettesnap-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.6.0

File hashes

Hashes for palettesnap-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8834088bbe45768175c381d3d98a047d217dec7a66d571149360c40fe271fe4f
MD5 e54dd09e01f3fa17a7244aa50fa68d5c
BLAKE2b-256 1666f4d7352d2169c3b1cf9248e8b26061912f43635810cc55ee2c7c99542ccf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page