A hex color blender written in Rust.
Go to file
2024-01-14 22:43:19 +01:00
.github/workflows update workflow 2023-12-24 14:30:58 +01:00
src fix code 2024-01-14 22:43:19 +01:00
.gitignore Change project files; add StructOpt 2023-10-14 13:23:17 +02:00
Cargo.lock fix code 2024-01-14 22:43:19 +01:00
Cargo.toml Merge branch 'main' into 2024.01.06 2024-01-14 22:29:58 +01:00
CHANGELOG.md fix cargo.toml 2024-01-14 22:24:39 +01:00
CODE_OF_CONDUCT.md 9th December 2023: 0.2.0 (#3) 2023-12-09 01:08:16 +01:00
LICENSE.md Change project files; add StructOpt 2023-10-14 13:23:17 +02:00
README.md update readme and changelog 2023-12-24 14:30:47 +01:00

color-blender-rs

A color blender, written in Rust. The color blender takes two hexadecimal colors as input, along with the number of midpoints to generate between those two colors.

License Project Status Contributions Welcome

Table of Contents

  1. Installation
  2. Usage
  3. Contributing
  4. License
  5. Project status

Installation

To build this application from source, you need rustup to use Cargo. Otherwise, you can download the precompile binaries.

Once you have successfully installed Rust and Cargo, you can proceed to build and install this program by executing the following command:

$ cargo build --release

Usage

$ ./color-blender-rs <first-color> <second-color> [-m <midpoints> -o <output-file> --benchmark>]
  • <start color>: The starting hexadecimal color (e.g., "#ff0000" for red).
  • <end color>: The ending hexadecimal color (e.g., "#00ff00" for green).
  • <midpoints>: The number of midpoints to generate between the start and end colors. The default is 10.
  • <output-file>: The output file to write the blended colors. (default: print colors to console).
  • <benchmark>: Gets the time it takes to blend the colors in microseconds.

Examples

Blend 5 midpoints between red (#ff0000) and green (#00ff00) and display the results in the console:

$ ./color-blender-rs "#ff0000" "#00ff00" 5

Blend 10 midpoints between blue (#0000ff) and yellow (#ffff00) and write the output to default (output.txt):

$ ./color-blender-rs "#0000ff" "#ffff00" 10 -o output.txt

Contributing

Contributions to the color-blender-rs project are always welcome! If you want to contribute:

  • Follow the same code style. Format your code using:
$ rustfmt --edition 2021 src/*
  • Obviously, follow the code of conduct.
  • I recommend using Rust stable rather than Rust nightly, for compatibility purposes. If you notice my code has Rust nightly features, feel free to replace them with stable equivalents.
  • If you have to use an external library, please use lightweight ones (eg. ureq over reqwest, async-std over tokio)
  • Prefer using the standard library over reinventing the wheel.
  • For big changes (let's take a new feature), open an issue, and describe the following points:
    • Why should it be added? What does it add and why should it even be considered?
    • What's the difference between using it and not using it?

If you need help or guidance with this project, open an issue.

License

This project is licensed under the GNU General Public License, version 3.

Project status

Development is not particularly active as I work on it when I have time. Contributions are welcome.