Dark theme, why not
This commit is contained in:
parent
3944277b02
commit
d20ce27a5d
|
@ -1,6 +1,3 @@
|
|||
@define-color colorAccent #9aa7c8;
|
||||
@define-color colorPrimary #9aa7c8;
|
||||
|
||||
.mode .button{
|
||||
border-radius:0px;
|
||||
border-top:none;
|
||||
|
@ -24,12 +21,8 @@
|
|||
background-position: 50%;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.header-counters{
|
||||
background:rgba(255,255,255,.4);
|
||||
}
|
||||
|
||||
.attachment{
|
||||
background: #fff;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/com/github/bleakgrey/tootle/">
|
||||
<file alias="Application.css">Application.css</file>
|
||||
<file alias="app.css">app.css</file>
|
||||
<file alias="light.css">light.css</file>
|
||||
<file alias="dark.css">dark.css</file>
|
||||
<file alias="logo128">logo128.png</file>
|
||||
<file alias="empty_state">empty_state.png</file>
|
||||
</gresource>
|
||||
|
|
|
@ -46,5 +46,10 @@
|
|||
<summary>Update timelines in real-time</summary>
|
||||
<description></description>
|
||||
</key>
|
||||
<key name="dark-theme" type="b">
|
||||
<default>false</default>
|
||||
<summary>Sets application theme to dark</summary>
|
||||
<description></description>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
@define-color colorAccent #9aa7c8;
|
||||
@define-color colorPrimary #333542;
|
||||
|
||||
.header-counters{
|
||||
background: rgba(0,0,0,.4);
|
||||
}
|
||||
|
||||
.attachment{
|
||||
background: rgba (255,255,255,.3);
|
||||
}
|
||||
|
||||
.card{
|
||||
background: rgba (255,255,255,.15);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
@define-color colorAccent #9aa7c8;
|
||||
@define-color colorPrimary #9aa7c8;
|
||||
|
||||
.header-counters{
|
||||
background: rgba(255,255,255,.4);
|
||||
}
|
||||
|
||||
.attachment{
|
||||
background: rgba (255,255,255,.8);
|
||||
}
|
||||
|
||||
.card{
|
||||
background: #fff;
|
||||
}
|
|
@ -19,6 +19,10 @@ public class Tootle.SettingsDialog : Gtk.Dialog {
|
|||
int i = 0;
|
||||
grid = new Gtk.Grid ();
|
||||
|
||||
grid.attach (new Granite.HeaderLabel (_("Appearance")), 0, i++, 2, 1);
|
||||
grid.attach (new SettingsLabel (_("Dark theme:")), 0, i);
|
||||
grid.attach (new SettingsSwitch ("dark-theme"), 1, i++);
|
||||
|
||||
grid.attach (new Granite.HeaderLabel (_("Timelines")), 0, i++, 2, 1);
|
||||
grid.attach (new SettingsLabel (_("Real-time updates:")), 0, i);
|
||||
grid.attach (new SettingsSwitch ("live-updates"), 1, i++);
|
||||
|
|
|
@ -15,9 +15,12 @@ public class Tootle.MainWindow: Gtk.Window {
|
|||
settings = Tootle.settings;
|
||||
|
||||
var provider = new Gtk.CssProvider ();
|
||||
provider.load_from_resource ("/com/github/bleakgrey/tootle/Application.css");
|
||||
provider.load_from_resource ("/com/github/bleakgrey/tootle/app.css");
|
||||
StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
settings.changed.connect (update_theme);
|
||||
update_theme ();
|
||||
|
||||
toast = new Granite.Widgets.Toast ("");
|
||||
overlay = new Gtk.Overlay ();
|
||||
overlay.add_overlay (toast);
|
||||
|
@ -120,9 +123,18 @@ public class Tootle.MainWindow: Gtk.Window {
|
|||
if (!Tootle.settings.always_online)
|
||||
Tootle.app.remove_window (Tootle.window_dummy);
|
||||
Tootle.window = null;
|
||||
this.dispose ();
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
private void update_theme () {
|
||||
var provider = new Gtk.CssProvider ();
|
||||
var is_dark = settings.dark_theme;
|
||||
var theme = is_dark ? "dark" : "light";
|
||||
provider.load_from_resource ("/com/github/bleakgrey/tootle/%s.css".printf (theme));
|
||||
StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = is_dark;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ public class Tootle.SettingsManager : Granite.Services.Settings {
|
|||
public bool cache { get; set; }
|
||||
public int cache_size { get; set; }
|
||||
public bool live_updates { get; set; }
|
||||
public bool dark_theme { get; set; }
|
||||
|
||||
public void clear_account (){
|
||||
access_token = "null";
|
||||
|
|
|
@ -112,7 +112,6 @@ public class Tootle.StatusWidget : Gtk.EventBox {
|
|||
public StatusWidget (ref Status status) {
|
||||
this.status = status;
|
||||
this.status.updated.connect (rebind);
|
||||
get_style_context ().add_class ("status");
|
||||
|
||||
if (this.status.reblog != null) {
|
||||
var image = new Gtk.Image.from_icon_name("go-up-symbolic", Gtk.IconSize.BUTTON);
|
||||
|
|
Loading…
Reference in New Issue