resurrect another color scheme idea

This commit is contained in:
Dustin Carlino 2020-04-04 18:28:30 -07:00
parent b62c293104
commit 0bec946dce
3 changed files with 22 additions and 4 deletions

View File

@ -19,6 +19,7 @@ pub enum ColorSchemeChoice {
SAMDesertDay,
BAP,
OSM,
Starcat,
}
impl ColorSchemeChoice {
@ -30,6 +31,7 @@ impl ColorSchemeChoice {
Choice::new("sam desert day", ColorSchemeChoice::SAMDesertDay),
Choice::new("bap", ColorSchemeChoice::BAP),
Choice::new("osm", ColorSchemeChoice::OSM),
Choice::new("starcat", ColorSchemeChoice::Starcat),
]
}
}
@ -120,6 +122,7 @@ impl ColorScheme {
ColorSchemeChoice::SAMDesertDay => ColorScheme::sam_desert_day(),
ColorSchemeChoice::BAP => ColorScheme::bap(),
ColorSchemeChoice::OSM => ColorScheme::osm(),
ColorSchemeChoice::Starcat => ColorScheme::starcat(),
}
}
@ -208,7 +211,7 @@ impl ColorScheme {
}
}
pub fn rotating_color_map(&self, idx: usize) -> Color {
pub fn rotating_color_plot(&self, idx: usize) -> Color {
modulo_color(
&vec![
Color::RED,
@ -303,4 +306,19 @@ impl ColorScheme {
cs.road_center_line = Color::rgb(202, 177, 39);
cs
}
fn starcat() -> ColorScheme {
let mut cs = ColorScheme::standard();
cs.grass = hex("#3F8C0C");
cs.building = hex("#8099A8"); // #5E7486
cs.map_background = hex("#737373");
cs.driving_lane = hex("#2A2A2A"); // TODO for arterial
cs.road_center_line = hex("#DB952E");
cs.general_road_marking = hex("#D6D6D6");
cs.sidewalk = cs.general_road_marking;
cs.sidewalk_lines = hex("#707070");
cs.bike_lane = hex("#72CE36");
cs.bus_lane = hex("#AD302D");
cs
}
}

View File

@ -129,7 +129,7 @@ fn delays_over_time(ctx: &mut EventCtx, app: &App, id: BusRouteID) -> Widget {
};
series.push(Series {
label: format!("Stop {}->{}", idx1 + 1, idx2 + 1),
color: app.cs.rotating_color_map(idx1),
color: app.cs.rotating_color_plot(idx1),
pts: delays_per_stop
.remove(&route.stops[idx2])
.unwrap_or_else(Vec::new),

View File

@ -119,7 +119,7 @@ fn delay_plot(ctx: &EventCtx, app: &App, i: IntersectionID, opts: &DataOptions)
{
all_series.push(Series {
label: stat.to_string(),
color: app.cs.rotating_color_map(idx),
color: app.cs.rotating_color_plot(idx),
pts,
});
}
@ -130,7 +130,7 @@ fn delay_plot(ctx: &EventCtx, app: &App, i: IntersectionID, opts: &DataOptions)
{
all_series.push(Series {
label: format!("{} (baseline)", stat),
color: app.cs.rotating_color_map(idx).alpha(0.3),
color: app.cs.rotating_color_plot(idx).alpha(0.3),
pts,
});
}