rand_rgb

Crates.iorand_rgb
lib.rsrand_rgb
version0.1.0
sourcesrc
created_at2023-07-10 01:14:03.271736
updated_at2023-07-10 01:14:03.271736
descriptionGenerate a random rgba-formatted color.
homepage
repository
max_upload_size
id912460
size6,690
é. urcades (urcades)

documentation

README

Generate a random rgba()-formatted color.

About

Inspired by "random-rgb-color" by mrmrs, which was in turn inspired by random-hex-color by John Otander.

This is a simple project for learning idiomatic Rust, publishing Rust projects, and how to approximate other programs using Rust.

Intended Use

It can be used to generate a string such as rgba(179, 134, 103, 0.33), or a rust struct that looks like this:

RandomColor { 
    red: 189, 
    green: 138, 
    blue: 54, 
    alpha: 0.79 
}

Next steps

  • Write actual docs
  • Update the functions to accomodate for default values if min/max values aren't provided
  • Compress the two functions for producing Strings and RandomColor structs into a single expression, possibly using enums?
  • Improve the commenting, and learn how doc comments work
  • Make it more idiomatic, squeeze out performance, etc.
Commit count: 0

cargo fmt