[gnome-music/wip/cdavis/dark-style-opt-in: 17/20] 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: 17/20] defaulticon: Add dark placeholder style
- Date: Wed, 2 Feb 2022 11:51:42 +0000 (UTC)
commit 0673b63f13af814f7467f10e5006c55f7d2bf5f6
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 | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/defaulticon.py b/gnomemusic/defaulticon.py
index 0ce4da6ff..95def3e62 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,17 @@ 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]