All Projects → elementh → random_color

elementh / random_color

Licence: MIT license
⚙️🎨 Rust crate for generating random attractive colors

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to random color

Colore
A powerful C# library for Razer Chroma's SDK
Stars: ✭ 121 (+303.33%)
Mutual labels:  colors, rgb
Randomcolor
Javascript module for generating random, distinguishable, pleasing colors (ie: for chart series).
Stars: ✭ 83 (+176.67%)
Mutual labels:  random, colors
Gradstop
JavaScript micro library to generate gradient color stops 🏳️‍🌈
Stars: ✭ 144 (+380%)
Mutual labels:  colors, rgb
Color.js
Extract colors from an image (0.75 KB) 🎨
Stars: ✭ 42 (+40%)
Mutual labels:  colors, rgb
golden-colors
Generate random colors using Golden ratio conjugate
Stars: ✭ 16 (-46.67%)
Mutual labels:  random, colors
Colority
🎨 (~1kb) library to extract colors from pictures.
Stars: ✭ 74 (+146.67%)
Mutual labels:  colors, rgb
color
A library of well-tested helper methods for working with colors.
Stars: ✭ 13 (-56.67%)
Mutual labels:  random, rgb
colors-convert
🦚 A simple colors library
Stars: ✭ 15 (-50%)
Mutual labels:  colors, rgb
Sand-Table
An open-source platform for building DIY sand tables (like the Sisyphus or ZenXY)
Stars: ✭ 99 (+230%)
Mutual labels:  art, rgb
leeks.js
Simple ANSI styling for your terminal
Stars: ✭ 12 (-60%)
Mutual labels:  colors, rgb
Sorted Colors
A tool to sort the named CSS colors in a way that it shows related colors together
Stars: ✭ 167 (+456.67%)
Mutual labels:  colors, rgb
global-color-picker
start the script and click anywhere to get rgb value at the cursor location
Stars: ✭ 31 (+3.33%)
Mutual labels:  colors, rgb
React Color Extractor
A React component which extracts colors from an image
Stars: ✭ 314 (+946.67%)
Mutual labels:  colors, rgb
Values.js
🍇 Get the tints and shades of a color
Stars: ✭ 97 (+223.33%)
Mutual labels:  colors, rgb
ColorPicker
Customizable Color Picker control for WPF
Stars: ✭ 57 (+90%)
Mutual labels:  colors, rgb
Tints And Shades
🌈 Display tints and shades of a given hex color in 10% increments.
Stars: ✭ 228 (+660%)
Mutual labels:  colors, rgb
Motus-Art
Weekly motion art projects created in JavaScript.
Stars: ✭ 129 (+330%)
Mutual labels:  art, colors
go-rainbow
Golang Helper for beautiful CLI Applications
Stars: ✭ 86 (+186.67%)
Mutual labels:  colors, rgb
colorsys
🎨 Minimalistic color converter for RGB, HSV, HSL, CMYK, HEX and CSS strings
Stars: ✭ 53 (+76.67%)
Mutual labels:  random, rgb
samila
Generative Art Generator
Stars: ✭ 750 (+2400%)
Mutual labels:  art

random_color

crate badge

Rust crate for generating random attractive colors. Check it out on crates.io.

Inspired by RandomColor by davidmerfield.

Example projects

Amazing rust projects using random_color:

cargo-trend — cargo subcommand to generate trend graph of dependent crates

light_phylogeny — rust library dedicated to phylogeny

Voronoi — simple program that draws Voronoi cells for a set of points

conways-game-of-life — conways' game of life in rust and with shiny colors

graph-sketchpad — program which allows one to visually create nodes and edges, simply using sdl2

CDCS — helper program for creating Symphony of Empires mods

Using the library

Check the online documentation.

use random_color::{Color, Luminosity, RandomColor};

let color = RandomColor::new()
  .hue(Color::Blue) // Optional
  .luminosity(Luminosity::Light) // Optional
  .seed(42) // Optional
  .alpha(1.0) // Optional
  .to_hsl_string(); // 

// color => "hsl(179, 99%, 10%)"

Hue values

  • Color::Monochrome
  • Color::Red
  • Color::Orange
  • Color::Yellow
  • Color::Green
  • Color::Blue
  • Color::Purple
  • Color::Pink

Luminosity values

  • Luminosity::Random
  • Luminosity::Bright
  • Luminosity::Light
  • Luminosity::Dark

Alpha values

  • You can specify a value between 0 and 1 with .alpha()
  • You can specify a random value with .random_alpha()

Outputs

  // As HSV Array
  let color = RandomColor::new().to_hsv_array(); // color => [179, 20, 100]

  // As RGB String
  let color = RandomColor::new().to_rgb_string(); // color => "rgb(204, 255, 254)"

  // As RGBA String
  let color = RandomColor::new().to_rgba_string(); // color => "rgba(204, 255, 254, 1)"

  // As RGB Array
  let color = RandomColor::new().to_rgb_array(); // color => [204, 255, 254]

  // As HSL String
  let color = RandomColor::new().to_hsl_string(); // color => "hsl(179, 99%, 10%)"

  // As HSLA String
  let color = RandomColor::new().to_hsla_string(); // color => "hsl(179, 99%, 10%, 1)"

  // As HSL Array
  let color = RandomColor::new().to_hsl_array(); // color => [179, 99, 10]
  
  // As Hex String
  let color = RandomColor::new().to_hex(); // color => "#b31464"

Roadmap

  • Iteartor
  • Documentation

License

The MIT License (MIT)

Copyright (c) 2017 Lucas Maximiliano Marino

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].