Hardcode accent colors (#1683)

This commit is contained in:
Leo 2023-06-14 03:46:58 +09:00 committed by GitHub
parent c26f0a0920
commit 878a918c53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 80 deletions

View File

@ -1,21 +1,6 @@
/* /*
* Copyright 2021 elementary, Inc. (https://elementary.io) * Copyright 2021-2023 elementary, Inc. <https://elementary.io>
* * SPDX-License-Identifier: GPL-3.0-or-later
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authored by: Marius Meisenzahl <mariusmeisenzahl@gmail.com> * Authored by: Marius Meisenzahl <mariusmeisenzahl@gmail.com>
*/ */
@ -41,16 +26,16 @@ public class Gala.AccentColorManager : Object {
private Settings interface_settings; private Settings interface_settings;
private NamedColor[] theme_colors = { private NamedColor[] theme_colors = {
new NamedColor ("Blue", THEME_BLUE), new NamedColor ("Blue", THEME_BLUE, new Drawing.Color.from_int (0x3689e6)),
new NamedColor ("Mint", THEME_MINT), new NamedColor ("Mint", THEME_MINT, new Drawing.Color.from_int (0x28bca3)),
new NamedColor ("Green", THEME_GREEN), new NamedColor ("Green", THEME_GREEN, new Drawing.Color.from_int (0x68b723)),
new NamedColor ("Yellow", THEME_YELLOW), new NamedColor ("Yellow", THEME_YELLOW, new Drawing.Color.from_int (0xf9c440)),
new NamedColor ("Orange", THEME_ORANGE), new NamedColor ("Orange", THEME_ORANGE, new Drawing.Color.from_int (0xffa154)),
new NamedColor ("Red", THEME_RED), new NamedColor ("Red", THEME_RED, new Drawing.Color.from_int (0xed5353)),
new NamedColor ("Pink", THEME_PINK), new NamedColor ("Pink", THEME_PINK, new Drawing.Color.from_int (0xde3e80)),
new NamedColor ("Purple", THEME_PURPLE), new NamedColor ("Purple", THEME_PURPLE, new Drawing.Color.from_int (0xa56de2)),
new NamedColor ("Brown", THEME_BROWN), new NamedColor ("Brown", THEME_BROWN, new Drawing.Color.from_int (0x8a715e)),
new NamedColor ("Gray", THEME_GRAY) new NamedColor ("Gray", THEME_GRAY, new Drawing.Color.from_int (0x667885))
}; };
construct { construct {

View File

@ -1,21 +1,6 @@
/* /*
* Copyright 2021 elementary, Inc. (https://elementary.io) * Copyright 2021-2023 elementary, Inc. <https://elementary.io>
* * SPDX-License-Identifier: GPL-3.0-or-later
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authored by: Marius Meisenzahl <mariusmeisenzahl@gmail.com> * Authored by: Marius Meisenzahl <mariusmeisenzahl@gmail.com>
*/ */
@ -24,11 +9,11 @@ public class Gala.NamedColor : Object {
public string theme { get; construct set; } public string theme { get; construct set; }
public Drawing.Color color { get; construct set; } public Drawing.Color color { get; construct set; }
public NamedColor (string name, string theme) { public NamedColor (string name, string theme, Drawing.Color color) {
Object ( Object (
name: name, name: name,
theme: theme, theme: theme,
color: InternalUtils.get_accent_color_by_theme_name (theme) color: color
); );
} }
} }

View File

@ -1,19 +1,9 @@
// /*
// Copyright (C) 2012 Tom Beckmann, Rico Tzschichholz * Copyright 2012 Tom Beckmann
// * Copyright 2012 Rico Tzschichholz
// This program is free software: you can redistribute it and/or modify * Copyright 2023 elementary, Inc. <https://elementary.io>
// it under the terms of the GNU General Public License as published by * SPDX-License-Identifier: GPL-3.0-or-later
// the Free Software Foundation, either version 3 of the License, or */
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
namespace Gala { namespace Gala {
public enum InputArea { public enum InputArea {
@ -323,24 +313,6 @@ namespace Gala {
); );
} }
public static Drawing.Color get_accent_color_by_theme_name (string theme_name) {
var label_widget_path = new Gtk.WidgetPath ();
label_widget_path.append_type (GLib.Type.from_name ("label"));
label_widget_path.iter_set_object_name (-1, "selection");
var selection_style_context = new Gtk.StyleContext ();
unowned Gtk.CssProvider theme_provider = Gtk.CssProvider.get_named (theme_name, null);
selection_style_context.add_provider (theme_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER);
selection_style_context.set_path (label_widget_path);
var rgba = (Gdk.RGBA) selection_style_context.get_property (
Gtk.STYLE_PROPERTY_BACKGROUND_COLOR,
Gtk.StateFlags.NORMAL
);
return new Drawing.Color.from_rgba (rgba);
}
/** /**
* Returns the workspaces geometry following the only_on_primary settings. * Returns the workspaces geometry following the only_on_primary settings.
*/ */