[utils] color

main
annieversary 2021-08-15 21:34:50 +02:00
parent 195592f8cb
commit b58e6dc79d
4 changed files with 13 additions and 9 deletions

View File

@ -1,5 +1,6 @@
use nannou::prelude::*;
use utils::color::color;
use utils::record::record;
fn main() {
@ -14,15 +15,6 @@ fn model(_app: &App) -> Model {
fn update(_app: &App, _model: &mut Model, _update: Update) {}
const fn color(red: u8, green: u8, blue: u8) -> Rgb<u8> {
Rgb {
red,
green,
blue,
standard: std::marker::PhantomData::<nannou::color::encoding::Srgb>,
}
}
const BG: Rgb<u8> = color(0, 5, 5);
const BALL: Rgb<u8> = color(255, 255, 255);

10
crates/utils/src/color.rs Normal file
View File

@ -0,0 +1,10 @@
use nannou::prelude::*;
pub const fn color(red: u8, green: u8, blue: u8) -> Rgb<u8> {
Rgb {
red,
green,
blue,
standard: std::marker::PhantomData::<nannou::color::encoding::Srgb>,
}
}

View File

@ -1 +1,2 @@
pub mod color;
pub mod record;

View File

@ -1,5 +1,6 @@
use nannou::prelude::*;
use once_cell::sync::Lazy;
static RECORDING: Lazy<bool> = Lazy::new(|| {
let args: Vec<String> = std::env::args().collect();
args.len() > 1 && args[1] == "-record"