fix custom color
This commit is contained in:
parent
906ff06140
commit
d7c7557ece
3 changed files with 26 additions and 13 deletions
|
@ -32,7 +32,15 @@
|
|||
</screenshot>
|
||||
</screenshots>
|
||||
<releases>
|
||||
<release version="0.2.2" date="2017-11-18">
|
||||
<release version="0.2.3" date="2017-11-20">
|
||||
<description>
|
||||
<p>Fix:</p>
|
||||
<ul>
|
||||
<li>Custom settings in .desktop</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="0.2.2" date="2017-11-20">
|
||||
<description>
|
||||
<p>Fix:</p>
|
||||
<ul>
|
||||
|
|
|
@ -63,9 +63,11 @@ namespace Webpin {
|
|||
}
|
||||
}
|
||||
|
||||
Gdk.RGBA? _color;
|
||||
public Gdk.RGBA? color {
|
||||
get {
|
||||
Gdk.RGBA return_value = {0, 0, 0, 255};
|
||||
if (_color == null) {
|
||||
Gdk.RGBA return_value = {0, 0, 0, 0};
|
||||
this.file = new GLib.KeyFile();
|
||||
try {
|
||||
file.load_from_file (info.filename, KeyFileFlags.NONE);
|
||||
|
@ -77,10 +79,13 @@ namespace Webpin {
|
|||
warning (e.message);
|
||||
return null;
|
||||
}
|
||||
return return_value;
|
||||
_color = return_value;
|
||||
}
|
||||
return _color;
|
||||
} set {
|
||||
if (value != null) {
|
||||
var color = "#%02x%02x%02x".printf ((int)(value.red * 255), (int)(value.green * 255), (int)(value.blue * 255));
|
||||
_color = value;
|
||||
var color = "rgba (%d,%d,%d,1)".printf ((int)(value.red * 255), (int)(value.green * 255), (int)(value.blue * 255));
|
||||
edit_propertie ("X-Webpin-PrimaryColor", color);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Webpin {
|
|||
var color = desktop_file.color;
|
||||
if (color != null) {
|
||||
var mid = color.red + color.blue + color.green;
|
||||
if (mid / 3 < 0.3) {
|
||||
if (mid / 3 < 0.5) {
|
||||
Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = true;
|
||||
}
|
||||
Granite.Widgets.Utils.set_color_primary (this, color);
|
||||
|
|
Loading…
Reference in a new issue