monochrome shapes

This commit is contained in:
ntr 2020-01-17 17:40:56 +10:00
parent 8499b3bca8
commit 7bb0fe4961

View File

@ -113,10 +113,10 @@ pub fn shapes_write(id: Uuid) -> Result<Uuid, Error> {
];
let num_dist = WeightedIndex::new(n_shapes_items.iter().map(|v| v.1))?;
let n_shapes = num_dist.sample(&mut rng) as usize;
let h = rng.gen_range(0, 360);
write!(&mut svg, "<svg xmlns='http://www.w3.org/2000/svg' version='1.1' viewBox='-250 -250 500 500' width='1000' height='1000'><g>")?;
for i in 0..n_shapes + 1 {
let h = rng.gen_range(0, 360);
let s = s_dist.sample(&mut rng) as usize;
let l = l_dist.sample(&mut rng) as usize;
let colour = format!("hsl({:}, {:}%, {:}%)", h, s, l);