[gnome-software/wip/exalm/flatpak] star-image: Fix colors in dark and HC
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/exalm/flatpak] star-image: Fix colors in dark and HC
- Date: Tue, 15 Feb 2022 12:52:02 +0000 (UTC)
commit 2652394e14ff789a08789f2c04f0d5ed314e0b03
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue Feb 15 17:52:03 2022 +0500
star-image: Fix colors in dark and HC
This code needs a deeper rework, but just adjust colors for now.
Use @yellow_5 instead of manually referencing the same color as well.
Fixes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1638
src/gs-star-image.c | 19 ++++++++++---------
src/style-dark.css | 9 +++++++++
src/style-hc.css | 3 +--
src/style.css | 2 +-
4 files changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/src/gs-star-image.c b/src/gs-star-image.c
index f50c6e514..f5fb14f21 100644
--- a/src/gs-star-image.c
+++ b/src/gs-star-image.c
@@ -23,6 +23,8 @@
#include "gs-star-image.h"
+#include <adwaita.h>
+
struct _GsStarImage
{
GtkWidget parent_instance;
@@ -159,22 +161,23 @@ gs_star_image_snapshot (GtkWidget *widget,
if (radius > 0) {
GtkStyleContext *style_context;
- GdkRGBA *star_bg = NULL;
+ GdkRGBA star_bg = { 1, 1, 1, 1 };
GdkRGBA star_fg;
gint min_x = -radius, max_x = radius;
- /* TODO: read star_bg from CSS, somehow */
-
style_context = gtk_widget_get_style_context (widget);
gtk_style_context_get_color (style_context, &star_fg);
+ gtk_style_context_lookup_color (style_context, "card_fg_color", &star_bg);
+ if (adw_style_manager_get_high_contrast (adw_style_manager_get_default ()))
+ star_bg.alpha *= 0.4;
+ else
+ star_bg.alpha *= 0.2;
+
cairo_save (cr);
gs_star_image_outline_star (cr, allocation.x, allocation.y, radius, &min_x, &max_x);
cairo_clip (cr);
- if (star_bg)
- gdk_cairo_set_source_rgba (cr, star_bg);
- else
- cairo_set_source_rgb (cr, 0xde / 255.0, 0xdd / 255.0, 0xda / 255.0);
+ gdk_cairo_set_source_rgba (cr, &star_bg);
cairo_rectangle (cr, -radius, -radius, 2 * radius, 2 * radius);
cairo_fill (cr);
@@ -185,8 +188,6 @@ gs_star_image_snapshot (GtkWidget *widget,
cairo_rectangle (cr, min_x, -radius, (max_x - min_x) * fraction, 2 * radius);
cairo_fill (cr);
cairo_restore (cr);
-
- g_clear_pointer (&star_bg, gdk_rgba_free);
}
cairo_destroy (cr);
diff --git a/src/style-dark.css b/src/style-dark.css
index e0067795e..4c9ba8c44 100644
--- a/src/style-dark.css
+++ b/src/style-dark.css
@@ -103,3 +103,12 @@
background-image: linear-gradient(shade(#C2C1BE, .97) 1px, transparent 1px),
linear-gradient(90deg, shade(#C2C1BE, .97) 1px, transparent 1px);
}
+
+star-image {
+ color: @yellow_1;
+}
+
+.review-histogram star-image {
+ /* Specificity bump */
+ color: alpha(@theme_fg_color, .4);
+}
diff --git a/src/style-hc.css b/src/style-hc.css
index 956d145e1..fc600b7d1 100644
--- a/src/style-hc.css
+++ b/src/style-hc.css
@@ -21,8 +21,7 @@ review-bar,
}
star-image {
- color: #000000;
-
+ color: inherit;
}
.context-tile-lozenge {
diff --git a/src/style.css b/src/style.css
index 5ffcd9f97..4caa21883 100644
--- a/src/style.css
+++ b/src/style.css
@@ -274,7 +274,7 @@ flowboxchild {
}
star-image {
- color: #e5a50a;
+ color: @yellow_5;
}
.dimmer-label {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]