Convert your favorite images and wallpapers with your favorite color palettes/themes

Overview

dipc

crates.io

doprz' image palette converter

Convert your favorite images and wallpapers with your favorite color palettes/themes

Color Palettes/Themes

  • catppuccin
  • edge
  • everforest
  • gruvbox
  • gruvbox-material
  • nord
  • rose-pine
  • tokyo-night

Examples

Original Converted
Magic view of the Gosausee in the Austrian Alps Magic view of the Gosausee in the Austrian Alps_nord
Human vs Nature Human vs Nature_gruvbox

Image Credits

Victor Rosario - https://unsplash.com/@vrrosario

Ivan Rohovchenko - https://unsplash.com/@ivrn

Installation

Cargo

cargo install dipc

From Source

To build and install from source, first checkout the tag or branch you want to install, then run

cargo install --path .

This will build and install dipc in your ~/.cargo/bin. Make sure that ~/.cargo/bin is in your $PATH variable.

Usage

Convert your favorite images and wallpapers with your favorite color palettes/themes

Usage: dipc [OPTIONS] --image <FILE> --color-palette <COLOR_PALETTE> <--all|--color-palette-variation <COLOR_PALETTE_VARIATION>>

Options:
  -i, --image <FILE>
          The image to process
      --color-palette <COLOR_PALETTE>
          The color palette to use [possible values: catppuccin, edge, everforest, gruvbox, gruvbox-material, nord, rose-pine, tokyo-night]
  -a, --all
          Use all color palette variations
      --color-palette-variation <COLOR_PALETTE_VARIATION>
          Color palette variation(s) to use
  -v, --verbose...
          Verbose mode (-v, -vv, -vvv)
  -h, --help
          Print help
  -V, --version
          Print version

License

dipc is dual-licensed under the terms of both the MIT License and the Apache License 2.0

SPDX-License-Identifier: MIT OR Apache-2.0

Comments
  • merged LAB conversion and color approximation, removing an allocation.

    merged LAB conversion and color approximation, removing an allocation.

    I also added a pre-processing step to the palettes being used right before they're converted to LAB: It now runs a deduplication step, which has a large performance improvement whenever multiple styles of the same theme are used at the same time.

    opened by CordlessCoder 8
  • Rewrite

    Rewrite

    Finished the rewrite. The user can now provide their own themes. The generation of the LAB version of the image is now parallelized. It now reuses the original image allocation, only mutating its pixels. Added support for providing the theme as a JSON string. Reorganized the CLI. Added batch processing support. Added output folder parameter.

    enhancement 
    opened by CordlessCoder 6
  • use of unstable library feature 'is_some_and'

    use of unstable library feature 'is_some_and'

    Compiling after merging PR #1 causes this error at src/main.rs:93:10 use of unstable library feature 'is_some_and'

    // Print palettes
    let color = supports_color::on_cached(supports_color::Stream::Stdout)
        .is_some_and(|level| level.has_16m);
    
    bug 
    opened by doprz 3
  • Compiling from source return errors

    Compiling from source return errors

      Compiling dipc v0.5.0 (/home/rochalaj/dipc)
    warning: unused imports: `fs::File`, `io::BufReader`
     --> src/cli.rs:1:11
      |
    1 | use std::{fs::File, io::BufReader, path::PathBuf, str::FromStr};
      |           ^^^^^^^^  ^^^^^^^^^^^^^
      |
      = note: `#[warn(unused_imports)]` on by default
    
    warning: unused import: `serde_json::Value`
     --> src/cli.rs:4:5
      |
    4 | use serde_json::Value;
      |     ^^^^^^^^^^^^^^^^^
    
    error[E0599]: no variant named `RawJSON` found for enum `ColorPalette`
       --> src/config.rs:151:23
        |
    151 |         ColorPalette::RawJSON { .. } => String::new(),
        |                       ^^^^^^^ variant not found in `ColorPalette`
        |
       ::: src/cli.rs:107:1
        |
    107 | pub enum ColorPalette {
        | --------------------- variant `RawJSON` not found here
    
    error[E0277]: `ColorPaletteArgGroup` doesn't implement `std::fmt::Display`
      --> src/main.rs:53:13
       |
    53 |             cli.color_palette, cli.styles
       |             ^^^^^^^^^^^^^^^^^ `ColorPaletteArgGroup` cannot be formatted with the default formatter
       |
       = help: the trait `std::fmt::Display` is not implemented for `ColorPaletteArgGroup`
       = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
       = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)
    
    error[E0599]: no method named `clone` found for struct `ColorPaletteArgGroup` in the current scope
      --> src/main.rs:60:58
       |
    60 |     let palettes = match parse_palette(cli.color_palette.clone().get_json(), &cli.styles) {
       |                                                          ^^^^^ method not found in `ColorPaletteArgGroup`
       |
      ::: src/cli.rs:45:1
       |
    45 | struct ColorPaletteArgGroup {
       | --------------------------- method `clone` not found for this struct
       |
       = help: items from traits can only be used if the trait is implemented and in scope
       = note: the following trait defines an item `clone`, perhaps you need to implement it:
               candidate #1: `Clone`
    
    error[E0308]: mismatched types
       --> src/main.rs:162:50
        |
    162 |             let new_rgb = lab.to_nearest_palette(&palettes).to_rgb();
        |                               ------------------ ^^^^^^^^^ expected `&[Lab]`, found `&Vec<Palette>`
        |                               |
        |                               arguments to this method are incorrect
        |
        = note: expected reference `&[delta::Lab]`
                   found reference `&Vec<Palette>`
    note: method defined here
       --> src/delta.rs:35:12
        |
    35  |     pub fn to_nearest_palette(self, palette: &[Lab]) -> Self {
        |            ^^^^^^^^^^^^^^^^^^       ---------------
    
    error[E0308]: mismatched types
       --> src/main.rs:166:56
        |
    166 |         let output_file_name = output_file_name(&path, &cli.color_palette, &palettes);
        |                                ----------------        ^^^^^^^^^^^^^^^^^^ expected `&ColorPalette`, found `&ColorPaletteArgGroup`
        |                                |
        |                                arguments to this function are incorrect
        |
        = note: expected reference `&ColorPalette`
                   found reference `&ColorPaletteArgGroup`
    note: function defined here
       --> src/config.rs:137:8
        |
    137 | pub fn output_file_name(
        |        ^^^^^^^^^^^^^^^^
    138 |     input_file_path: &PathBuf,
    139 |     color_palette: &ColorPalette,
        |     ----------------------------
    
    Some errors have detailed explanations: E0277, E0308, E0599.
    For more information about an error, try `rustc --explain E0277`.
    warning: `dipc` (bin "dipc") generated 2 warnings
    error: could not compile `dipc` due to 5 previous errors; 2 warnings emitted
    error: failed to compile `dipc v0.5.0 (/home/rochalaj/dipc)`, intermediate artifacts can be found at `/home/rochalaj/dipc/target`
    

    cargo v1.69.0 OpenSuse Tumbleweed

    how to reproduce

    1. git clone https://github.com/doprz/dipc.git
    2. cd dipc
    3. cargo install --path .

    I did not obtain any kind of error installing directly from cargo with: cargo install dipc

    bug 
    opened by RochaLAJ 1
  • Fixed #10

    Fixed #10

    • Fixed #10
    • Fix .to_nearest_palette() incorrect args
      • expected reference &[delta::Lab]
      • found reference &Vec<Palette>
    • Fix non-exhaustive patterns: ColorPalette::RawJSON { .. } not covered
    • Change palettes to mutable
    bug 
    opened by doprz 0
  • Add `ColorPaletteArgGroup`

    Add `ColorPaletteArgGroup`

    • [ ] Add ColorPaletteArgGroup to Cli.
    • [ ] Separate choosing one of: color_palette, json_file, or raw_json for easier CLI usage.
    • [ ] Refactor code to add Cli args + features:
      • [ ] json_file
      • [ ] raw_json
    #[derive(Parser, Debug)]
    #[command(author, version, about, long_about = None)]
    pub struct Cli {
        // Options
        /// The color palette variation(s) to use
        /// Run with --help instead of -h for a list of all possible values
        ///
        /// Possible values:
        /// - `all` to generate an image for each of the variations
        /// - `none` if you are using a flat theme without variations
        /// - or a comma-delimited list of the names of variations it should use
        #[arg(
            short,
            long,
            value_name = "VARIATIONS",
            default_value = "all",
            verbatim_doc_comment
        )]
        pub styles: ColorPaletteStyles,
    
        /// Output directory
        #[arg(short, long, value_name = "PATH", default_value = "output")]
        pub output: PathBuf,
    
        /// Verbose mode (-v, -vv, -vvv)
        #[arg(short, long, action = clap::ArgAction::Count)]
        pub verbose: u8,
    
        // Arguments
        #[command(flatten)]
        pub color_palette: ColorPaletteArgGroup,
    
        /// The image(s) to process
        #[arg(value_name = "FILE")]
        pub process: Vec<PathBuf>,
    }
    
    #[derive(Args, Debug)]
    #[group(required = true, multiple = false)]
    struct ColorPaletteArgGroup {
        /// The color palette to use
        /// Run with --help instead of -h for a list of all builtin themes
        ///
        /// Builtin themes:
        /// - catppuccin
        /// - edge
        /// - everforest
        /// - gruvbox
        /// - gruvbox-material
        /// - nord
        /// - rose-pine
        /// - tokyo-night
        #[arg(short, long, value_enum, verbatim_doc_comment)]
        pub color_palette: ColorPalette,
    
        /// The path to a JSON file with the color palette
        #[arg(short, long)]
        pub json_file: PathBuf,
    
        /// A JSON string with the color palette (starting with `JSON: {}`)
        #[arg(short, long)]
        pub raw_json: String,
    }
    
    enhancement 
    opened by doprz 0
  • Move to Indicatif

    Move to Indicatif

    I suggest replacing the custom timing code and print statements with an indicatif-based Statusbar

    • [ ] Statusbar for loading & processing themes
    • [ ] Statusbar for processing each image
    enhancement 
    opened by CordlessCoder 3
Owner
null
Apple dynamic HEIF wallpapers on GNU/Linux.

timewall Apple dynamic HEIF wallpapers on GNU/Linux. Features: Support for original HEIF/HEIC dynamic wallpaper files used in MacOS. Support for all s

Bazyli Cyran 15 Dec 15, 2022
Rust library to convert RGB 24-bit colors into ANSI 256 (8-bit) color codes with zero dependencies and at compile-time.

rgb2ansi256 rgb2ansi256 is a small Rust library to convert RGB 24-bit colors into ANSI 256 (8-bit) color codes with zero dependencies and const fn. Th

Linda_pp 7 Nov 17, 2022
A simple command line tool for creating font palettes for engines like libtcod

palscii A simple command line tool for creating font palettes for engines like libtcod. Usage This can also be viewed by running palscii --help. palsc

Steve Troetti 2 May 2, 2022
Terminal UI that allows Alacritty users to quickly and easily shuffle through provided themes 🦄

Alac-pretty alac-pretty.mp4 If you're like me in that you constantly need to change the colors of your dev environment because visual stagnation reall

Benji Nguyen 17 Aug 29, 2022
A standalone code editor with syntax highlighting and themes.

CodeEditor A standalone code (and text) editor for people like me who write their own user interfaces utilizing crates like pixels. CodeEditor renders

Markus Moenig 8 Nov 25, 2022
A cli util to apply themes to hyprland

Hyprtheme works with themes installed at ~/.config/hypr/themes additional themes can be installed from hyprland-community/theme-repo theme.toml this f

Hyprland Community 4 Jan 15, 2023
A simple CLI tool to convert the images to ASCII art with rust 🦀💙

aarty: A simple CLI tool to convert images to ASCII art with Rust ?? More screenshots Original image Original image Original image Original image Orig

Anas Elgarhy 26 Feb 13, 2023
convert images to ansi or irc, with a bunch of post-processing filters

img2irc (0.2.0) img2irc is a utility which converts images to halfblock irc/ansi art, with a lot of post-processing filters halfblock means that each

null 6 Apr 4, 2023
A simple Node.js library to convert raster images into svg

@neplex/vectorizer A simple Node.js library to convert raster images into svg using VTracer, with time complexity of O(n). Installation npm install @n

Neplex 21 Dec 28, 2023
A CLI app to set and organize your favorite DNS servers.

rdns A CLI app to set and organize your favorite DNS servers. Introduction rdns is a CLI utility that can set your system DNS, either directly or by m

null 4 Feb 19, 2024
OSINT from your favorite services in a friendly terminal user interface

osintui Open Source Intelligence Terminal User Interface Report Bug · Request Feature Installation First, install Rust (using the recommended rustup i

Will Sheldon 639 Jan 4, 2023
🔍 quickly search with your favorite websites straight from the terminal

gg Search with your favorite websites straight from the terminal! gg-example.mp4 Configure gg To add more websites, just edit the ~/.gg.toml or %APP_D

Vedant Nandwana 4 Dec 31, 2022
Adapt the screen's color spectrum according to the hour of the day in order to improve your sleep

circadianlight What It Is Circadian Light is a program, currently only working on Linux with X, that controls the color spectrum of your screen accord

null 7 Dec 28, 2022
🎨✨ Show off your soothing color palette

?? Show off your soothing color palette ✨ Palettes · install · contribute · Gratitute ?? Palettes Rust C Lua Ruby Go sh js ?? install Installing this

BinaryBrainiacs 4 Jan 28, 2023
`ls` alternative with useful info and a splash of color 🎨

?? Natls ?? Why Natls? Showing file permissions Showing file size Showing the date that the file was modified last Showing the user that the file belo

Will 1.2k Dec 19, 2022
Detects whether a terminal supports color, and gives details about that support

Detects whether a terminal supports color, and gives details about that support. It takes into account the NO_COLOR environment variable. This crate i

Kat Marchán 30 Dec 29, 2022
An abstract, safe, and concise color conversion library for rust nightly This requires the feature adt_const_params

colortypes A type safe color conversion library This crate provides many methods for converting between color types. Everything is implemented abstrac

Jacob 13 Dec 7, 2022
A rust crate for working with colors and color spaces.

Color Art A rust crate for working with colors and color spaces. Documentation See Color Art. Usage Add Dependency [dependencies] color-art = "0.2" Co

cx33 5 Dec 30, 2022
Stockbook embeds 1-bit raster images in your code at compile time

stockbook Stockbook embeds 1-bit raster images in your code at compile time. Designed primarily for #![no_std] usage, in embedded or other program-mem

Karol Belina 3 Oct 27, 2022