Commit 185a3faa authored by Björn Daase's avatar Björn Daase
Browse files

ui: increase contrast when using dark themes

Fixes: GNOME/gnome-weather#124
parent 369055ae
Pipeline #266908 passed with stage
in 3 minutes and 8 seconds
......@@ -114,6 +114,12 @@ var HourlyForecastFrame = GObject.registerClass(class ForecastFrame extends Gtk.
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._box.pack_start(hourEntry, false, false, 0);
this._hasForecastInfo = true;
......@@ -210,6 +216,12 @@ var HourlyForecastFrame = GObject.registerClass(class ForecastFrame extends Gtk.
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(frameWidth, frameHeight);
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment