Skip to content

Commit

Permalink
different colors for up/down graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
stsdc committed Nov 25, 2020
1 parent 7973c2b commit 355e1b2
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
16 changes: 12 additions & 4 deletions data/Application.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
border-width: 0;
}

.green {
background-color: alpha(@LIME_300, 0.6);
}

.blue {
background-color: alpha(@BLUEBERRY_300, 0.6);
}

/* .vertical-label,
.vertical-label:hover,
.vertical-label:selected,
Expand Down Expand Up @@ -84,15 +92,15 @@
}

.core_badge-mild-warning {
background-color: @BANANA_100;
background-color: alpha(@BANANA_100, 0.7);
color: @BANANA_900;
border: 1px solid @BANANA_300;
border: 1px solid alpha(@BANANA_300, 0.7);
}

.core_badge-strong-warning {
background-color: @ORANGE_100;
background-color: alpha(@ORANGE_100, 0.7);
color: @ORANGE_900;
border: 1px solid @ORANGE_300;
border: 1px solid alpha(@ORANGE_300, 0.7);
}

.core_badge-critical-warning {
Expand Down
7 changes: 7 additions & 0 deletions src/Views/SystemView/SystemNetworkView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,21 @@ public class Monitor.SystemNetworkView : Gtk.Grid {
network = _network;

network_name_label = new LabelH4 (_("Network"));

network_download_label = new LabelRoundy (_("DOWN"));
network_download_label.val.set_width_chars (7);
network_download_label.set_color ("blue");

network_upload_label = new LabelRoundy (_("UP"));
network_upload_label.val.set_width_chars (7);
network_upload_label.set_color ("green");

network_chart = new Chart (2);
network_chart.config.y_axis.fixed_max = null;

network_chart.set_serie_color(0, { 155/255.0, 219/255.0, 77/255.0, 1.0 });
network_chart.set_serie_color(1, { 100/255.0, 186/255.0, 255/255.0, 1.0 });

var labels_grid = new Gtk.Grid ();
labels_grid.row_spacing = 6;
labels_grid.column_spacing = 6;
Expand Down
6 changes: 6 additions & 0 deletions src/Views/SystemView/SystemStorageView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@ public class Monitor.SystemStorageView : Gtk.Grid {
storage = _storage;

storage_name_label = new LabelH4 (_("Storage"));

storage_write_label = new LabelRoundy (_("WRITE"));
storage_write_label.val.set_width_chars (7);
storage_write_label.set_color ("blue");

storage_read_label = new LabelRoundy (_("READ"));
storage_read_label.val.set_width_chars (7);
storage_read_label.set_color ("green");

storage_chart = new Chart (2);
storage_chart.config.y_axis.fixed_max = null;
storage_chart.set_serie_color(0, { 155/255.0, 219/255.0, 77/255.0, 1.0 });
storage_chart.set_serie_color(1, { 100/255.0, 186/255.0, 255/255.0, 1.0 });

var labels_grid = new Gtk.Grid ();
labels_grid.row_spacing = 6;
Expand Down
8 changes: 8 additions & 0 deletions src/Widgets/Chart/Chart.vala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ public class Monitor.Chart : Gtk.Box {
add (live_chart);
}

public void set_serie_color(int serie_number, Gdk.RGBA color) {
try {
live_chart.series[serie_number].line.color = color;
} catch (LiveChart.ChartError e) {
error (e.message);
}
}

public void update (int serie_number, double value) {
try {
live_chart.series[serie_number].add (value);
Expand Down
4 changes: 4 additions & 0 deletions src/Widgets/Labels/LabelRoundy.vala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public class Monitor.LabelRoundy : Gtk.Fixed {
put (desc, 6, 0);
}

public void set_color (string colorname) {
val.get_style_context ().add_class (colorname);
}

public void set_text (string text) {
val.set_text (text);
}
Expand Down

0 comments on commit 355e1b2

Please sign in to comment.