[gnome-weather: 1/2] ui: increase contrast when using dark themes
- From: Vitaly Dyachkov <vitalydyachkov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-weather: 1/2] ui: increase contrast when using dark themes
- Date: Wed, 31 Mar 2021 15:46:57 +0000 (UTC)
commit 1351b16099a223ae219651de7c0db5da0720b8c0
Author: Björn Daase <bjoern daase net>
Date: Wed Mar 17 18:44:49 2021 +0100
ui: increase contrast when using dark themes
Fixes: https://gitlab.gnome.org/GNOME/gnome-weather/-/issues/124
src/app/hourlyForecast.js | 12 ++++++++++++
src/misc/util.js | 4 ++++
2 files changed, 16 insertions(+)
---
diff --git a/src/app/hourlyForecast.js b/src/app/hourlyForecast.js
index a0ab406..7f2da5d 100644
--- a/src/app/hourlyForecast.js
+++ b/src/app/hourlyForecast.js
@@ -110,6 +110,12 @@ var HourlyForecastBox = GObject.registerClass(class HourlyForecastBox extends Gt
hourEntry.image.iconName = info.get_icon_name() + '-small';
hourEntry.temperatureLabel.label = Util.getTempString(info);
+ if (Util.isDarkTheme()) {
+ const color = "#f6d32d";
+ const label = "<span color=\""+ color + "\">" + hourEntry.temperatureLabel.label + "</span>";
+ hourEntry.temperatureLabel.set_markup(label);
+ };
+
this.pack_start(hourEntry, false, false, 0);
this._hasForecastInfo = true;
@@ -179,6 +185,12 @@ var HourlyForecastBox = GObject.registerClass(class HourlyForecastBox extends Gt
cr.strokePreserve();
let [, fillColor] = this.get_style_context().lookup_color('temp_chart_fill_color');
+
+ if (Util.isDarkTheme()) {
+ fillColor = new Gdk.RGBA();
+ fillColor.parse("rgba(248, 228, 92, 0.15)");
+ };
+
Gdk.cairo_set_source_rgba(cr, fillColor);
cr.lineTo(width, height);
diff --git a/src/misc/util.js b/src/misc/util.js
index 9594ae8..54538d9 100644
--- a/src/misc/util.js
+++ b/src/misc/util.js
@@ -208,3 +208,7 @@ function getTempString(info) {
return "--";
return Math.round(temp) + "°";
}
+
+function isDarkTheme() {
+ return Gtk.Settings.get_default().gtk_theme_name.endsWith('-dark');
+}
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]