在哪里可以找到有关GNOME 3主题的参考方案(例如Adwaita)?


8

我升级到Fedora 21,该版本聚焦GNOME 3.14(以及相关的GTK +材料)。不幸的是,这个特定的更新似乎使我的许多较旧的主题变得混乱,这些主题是为GNOME 3的较新版本编写的。以前可能被它们所折磨,但现在看起来有些不合时宜。

我不打算重新发明轮子:我将很高兴采用一个预先存在的CSS模板(例如默认的Adwaita 3.14规范),并根据自己的喜好对其进行调整。不会有幻想的飞行。想象一下当我偷看/usr/share/themes/Adwaita/gtk-3.0/gtk.css时我撕开的头发:

/* Adwaita is the default theme of GTK+ 3, this file is not used */

那让我陷入了困境。我没有Google-fu来查找文档的详细信息(更糟糕的是,我有一种直觉,这对我所错过的GNOME人员而言是隐含的显而易见的东西),并且由于某些原因,GNOME开发人员网站拒绝这样做我尝试研究其主题规范。

简而言之,我想为GNOME 3.14找到一个原始主题规范,假设其中一个已经存在。我该怎么做,或如何修改我的方法?

Answers:


13

该特定.css文件中只有一行,因为默认主题(Adwaita)是二进制文件:

Adwaita is a complex theme, so to keep it maintainable it's written and processed in SASS, the generated CSS is
then transformed into a gresource file during gtk build and used at runtime in a non-legible or editable form.

由于已包含该代码gtk+,因此您可以在此处查看源文件。根据他们的readme

_colors.scss        - global color definitions. We keep the number of defined colors to a necessary minimum, most colors 
                      are derived form a handful of basics. It covers both the light variant and the dark variant.
_colors-public.scss - SCSS colors exported through gtk to allow for 3rd party apps color mixing.
_drawing.scss       - drawing helper mixings/functions to allow easier definition of widget drawing under specific context.
                      This is why Adwaita isn't 15000 LOC.
_common.scss        - actual definitions of style for each widget. This is where you are likely to add/remove your changes.

参考.css文件是:

gtk-contained.css
gtk-contained-dark.css

这是一个较旧的方法,一些内容不再适用(如我所说,源代码已在使用中gtk+,已gnome-themes-standard被弃用),但它应该使您走上正确的道路:

如何破解GNOME Adwaita GTK主题


0

我正在从有关窗口顶部栏颜色的类似问题中复制自己的TLDR

〜/ .config / gtk-3.0 / gtk.css

/* REMOVE "-dark" IF USING LIGHT THEME */
@import url("resource:///org/gtk/libgtk/theme/Adwaita/gtk-contained-dark.css");

/* THIS ONE CHANGES TITLEBAR COLOR */
headerbar.titlebar,
headerbar.titlebar:active {
    background:#3F51B5;
}

/* THIS CHANGES NAUTILUS SEARCH BAR */
.horizontal.path-bar-box,
row:selected:backdrop {
     background:#3F51B5;
     border-color:#3F51B5;
}

要调试并找到合适的CSS选择器,请打开环境变量GTK_DEBUG = interactive的GTK3应用。例如,

GTK_DEBUG=interactive nautilus

这将打开GTK窗口的检查器。如果不存在,请按Ctrl + Shift + I。

检查员的屏幕截图

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.