thaimeleon

Crates.iothaimeleon
lib.rsthaimeleon
version0.1.2
created_at2025-09-21 17:03:56.06334+00
updated_at2025-09-21 18:09:57.056487+00
descriptionCreate a color scheme based on an image
homepage
repositoryhttps://codeberg.org/thairanaru/thaimeleon
max_upload_size
id1848957
size251,482
(thairanaru)

documentation

README

Thaimeleon

Gif demo of Thaimeleon palettes

An opinionated color scheme generator that uses a wallpaper input!

  • Supports for light themes ☀️ and dark themes 🌑

  • Generates a forty-five color palette, ensuring accessibility for every TUI and GUI situation!

  • Uses k-means, weighted ward's method of minimum variance, and OKLAB to determine representative background colors and foreground colors of a wallpaper

  • Uses OKLCH to ensure perpetual chromatic clarity 🌈

  • In addition to json, toml, yaml, and ron, Thaimeleon can generate a rhai file to allow perfect integration with Yolk ⚙️

  • Thaimeleon uses Rust 🦀

  • Enable cache to make Thaimeleon run at lightning speed ⚡

  • Although not compliant to, this project uses a formula built on Andrew Somers' DPS Contrast, in order to retain reasonable contrast

Installation

From crates.io

With cargo installed, do the following command in your shell:

cargo install thaimeleon

Make sure the cargo binary location is in PATH

Compile from source

With cargo and git installed, do the following commands in your shell:

git clone https://codeberg.org/thairanaru/thaimeleon.git
cd thaimeleon
cargo install --path .

Usage

The recommended method of using Thaimeleon is to generate a palette file, which is then processed by a dot file manager. For reference, in my wallpaper changer script, I have:

    thaimeleon "$selected_wallpaper" -w ~/.config/yolk/chameleon.rhai 
    yolk sync

However, thaimeleon will adjust contents by the file extension. Currently, json, toml, yaml, rhai, and ron are supported.

For details of the color palette, read here.

To enable experimental base16 output, add the --base16 or -b flag. Note that Thaimeleon isn't designed around base 16 (because Thaimeleon color palette is superior) nor I have tested results.

For screenshots, add the --print-pretty-palette or -p flag.

Configuration

Thaimeleon can be configured in ~/.config/thaimeleon/thaimeleon.toml. Generate a default config with thaimeleon --generate-config-file and read the default config file for documentation. I recommend turning on cache once you get settled. It does have options to configure Thaimeleon's algorithm but caution! Once you start changing the defaults, you now hold responsibility. For a more detailed understanding, check out here for information how the algorithm works.

Road Map

  • Expand Thaimeleon's palette to support color schemes that flips foreground and background for colored surfaces

Contributing

Pull requests are welcomed, though be warned that I am entirely self taught and haven't programmed since I was 12, so the codebase might be difficult to work with.

The algorithm is constructed largely through experimentation and personal taste rather than scientific theory. In other words, feel free to play around with it. Check out here for information how the algorithm works.

Suggestions for dot file manager/theming templating integration are also welcomed. As you see, I only use yolk.

Licensing

With the exception of the dps_contrast module in src/contrast.rs, this project is licensed under the AGPL v3.

The dps_contrast module is licensed under the DPS CONTRAST (DELTA PHI STAR) LICENSE, a modified version of the AGPL v3 license. All rights of the formula to Andrew Somers.

For the licenses of the images shown in the demo, check out LICENSES/licenses.md

Similar projects to try out

  • Matugen - uses Material You which uses HCT, so this should be good. I haven't tried this personally yet, but I don't see how anything could go wrong with that approach.
Commit count: 0

cargo fmt