alpha
Login
or
Join now
gwen.works
/
shapemaker
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
✨ Make background color random
author
Ewen Le Bihan
date
3 years ago
(Dec 29, 2022, 8:01 PM +0100)
commit
b071619e
b071619ebc69dd9e6d458bc80447538af504e28d
parent
ac1d4174
ac1d41745d93d9e9f0ef5f727c1469ee9db7fd56
+11
-7
1 changed file
Expand all
Collapse all
Unified
Split
src
main.rs
+11
-7
src/main.rs
Reviewed
···
451
451
impl Shape {
452
452
fn render(self, colormap: ColorMapping) -> String {
453
453
let default_color = Color::Black.to_string(&colormap);
454
454
-
let mut svg = svg::Document::new();
454
454
+
let background_color = random_color();
455
455
+
eprintln!("render: background_color({:?})", background_color);
456
456
+
let mut svg = svg::Document::new().add(
457
457
+
svg::node::element::Rectangle::new()
458
458
+
.set("x", -10)
459
459
+
.set("y", -10)
460
460
+
.set("width", 130)
461
461
+
.set("height", 130)
462
462
+
.set("fill", background_color.to_string(&colormap)),
463
463
+
);
455
464
for (object, maybe_fill) in self.objects {
456
465
let mut group = svg::node::element::Group::new();
457
466
match object {
···
692
701
}
693
702
}
694
703
}
695
695
-
svg.set("viewBox", "-10 -10 120 120")
696
696
-
.set(
697
697
-
"style",
698
698
-
format!("background-color: {};", Color::White.to_string(&colormap)),
699
699
-
)
700
700
-
.to_string()
704
704
+
svg.set("viewBox", "-10 -10 120 120").to_string()
701
705
}
702
706
}
703
707