doprz / dipc Goto Github PK
View Code? Open in Web Editor NEWConvert your favorite images and wallpapers with your favorite color palettes/themes
License: Apache License 2.0
Convert your favorite images and wallpapers with your favorite color palettes/themes
License: Apache License 2.0
Hi there,
I was looking into your implementation and I saw it's very similar to a 2020 project from https://github.com/Schrodinger-Hat/ImageGoNord
It's in python, it has a CLI as well as a website accessible for everyone.
Would you mind on collaborating with us there? It would be great ๐
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
I did not obtain any kind of error installing directly from cargo with: cargo install dipc
ColorPaletteArgGroup
to Cli
.color_palette
, json_file
, or raw_json
for easier CLI usage.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,
}
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);
I suggest replacing the custom timing code and print statements with an indicatif-based Statusbar
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.