Skip to content
Snippets Groups Projects
Verified Commit 3d1ad4f8 authored by Bruce Cowan's avatar Bruce Cowan :airplane:
Browse files

Some style improvements

parent 77a42c2b
Branches master
No related tags found
No related merge requests found
Pipeline #4705 failed
......@@ -78,7 +78,7 @@ template $RugbyAppWindow : Adw.ApplicationWindow {
};
};
styles ["rich-list", "card"]
styles ["rich-list"]
}
}
};
......
......@@ -5,5 +5,5 @@
*/
listview {
margin: 24px 12px;
background-color: var(--window-bg-color);
}
......@@ -77,11 +77,12 @@ rugby_possibility_widget_set_property (GObject *object,
}
static void
render_bar (GtkSnapshot *snapshot,
float x,
float w,
float h,
const GdkRGBA rgba)
render_bar (GtkSnapshot *snapshot,
float x,
float w,
float h,
const GdkRGBA fill,
const GdkRGBA border)
{
graphene_rect_t area = GRAPHENE_RECT_INIT (x, 0.0, w, h);
......@@ -92,17 +93,10 @@ render_bar (GtkSnapshot *snapshot,
gtk_snapshot_push_rounded_clip (snapshot, &rounded);
gtk_snapshot_append_color (snapshot,
&rgba,
&fill,
&area);
gtk_snapshot_pop (snapshot);
GdkRGBA border;
AdwStyleManager *manager = adw_style_manager_get_default ();
if (adw_style_manager_get_dark (manager))
gdk_rgba_parse (&border, "white");
else
gdk_rgba_parse (&border, "black");
gtk_snapshot_append_border (snapshot,
&rounded,
(float[]) { 2.0, 2.0, 2.0, 2.0 },
......@@ -132,32 +126,40 @@ rugby_possibility_widget_snapshot (GtkWidget *widget,
int score = tries * try_points + utries * utry_points + kicks * kick_points;
GdkRGBA rgba;
GdkRGBA fill;
GdkRGBA border;
AdwStyleManager *manager = adw_style_manager_get_default ();
if (adw_style_manager_get_dark (manager))
gdk_rgba_parse (&border, "white");
else
gdk_rgba_parse (&border, "black");
// Tries
float w = width / (score / (float) try_points);
gdk_rgba_parse (&fill, "#33d17a"); // Green 3
for (int i = 0; i < tries; i++)
{
gdk_rgba_parse (&rgba, "#33d17a"); // Green 3
render_bar (snapshot, x, w, height, rgba);
render_bar (snapshot, x, w, height, fill, border);
x += w;
}
// Unconverted tries
w = width / (score / (float) utry_points);
gdk_rgba_parse (&fill, "#f6d32d"); // Yellow 3
for (int i = 0; i < utries; i++)
{
gdk_rgba_parse (&rgba, "#e01b24"); // Red 3
render_bar (snapshot, x, w, height, rgba);
render_bar (snapshot, x, w, height, fill, border);
x += w;
}
// Unconverted kicks
// Kicks
w = width / (score / (float) kick_points);
gdk_rgba_parse (&fill, "#e01b24"); // Red 3
for (int i = 0; i < kicks; i++)
{
gdk_rgba_parse (&rgba, "#f6d32d"); // Yellow 3
render_bar (snapshot, x, w, height, rgba);
render_bar (snapshot, x, w, height, fill, border);
x += w;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment