[gnome-music/wip/cdavis/dark-style-opt-in: 7/7] defaulticon: Add dark placeholder style
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/cdavis/dark-style-opt-in: 7/7] defaulticon: Add dark placeholder style
- Date: Thu, 7 Oct 2021 10:14:58 +0000 (UTC)
commit dd3b3e3bb57ee51c1cc493e6cb3549ee37280edd
Author: Christopher Davis <christopherdavis gnome org>
Date: Thu Oct 7 03:14:00 2021 -0700
defaulticon: Add dark placeholder style
This currently only works when the app is
launched in dark mode.
gnomemusic/defaulticon.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/defaulticon.py b/gnomemusic/defaulticon.py
index 0ce4da6ff..7969ea136 100644
--- a/gnomemusic/defaulticon.py
+++ b/gnomemusic/defaulticon.py
@@ -27,7 +27,7 @@ from math import pi
from typing import Dict, Tuple
import cairo
-from gi.repository import Gtk, GObject
+from gi.repository import Gtk, GObject, Gdk, Handy
from gnomemusic.utils import ArtSize
@@ -76,10 +76,16 @@ def make_icon_frame(
ctx.arc(radius, h - radius, radius, 90 * degrees, 180 * degrees)
ctx.arc(radius, radius, radius, 180 * degrees, 270 * degrees)
+ fill_color = Gdk.RGBA(1.0, 1.0, 1.0, 1.0)
+ icon_color = Gdk.RGBA(0.0, 0.0, 0.0, 0.3)
+ if Handy.StyleManager.get_default().props.dark:
+ fill_color = Gdk.RGBA(66.0 / 255, 66.0 / 255, 66.0 / 255, 1.0)
+ icon_color = Gdk.RGBA(1.0, 1.0, 1.0, 1.0)
+
if default_icon:
- ctx.set_source_rgb(1, 1, 1)
+ ctx.set_source_rgb(fill_color.red, fill_color.green, fill_color.blue)
ctx.fill()
- ctx.set_source_rgba(0, 0, 0, 0.3)
+ ctx.set_source_rgba(icon_color.red, icon_color.green, icon_color.blue, icon_color.alpha)
ctx.mask_surface(icon_surface, w / 3, h / 3)
ctx.fill()
else:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]