HACKING.md
ASCII text
Summary
Do not edit the CSS directly, edit the source SCSS files and run
./parse-sass.sh.You'll need to have
sasscinstalled.
Do not edit the PNG directly, edit the source SVG files and run
./render-assets.sh.You'll need to have
inkscapeandoptipnginstalled.
To change the colors of SVG files, use a text editor instead of a image editor.
How to tweak the theme
SCSS
Like the upstream Adwaita, to keep it maintainable it's written and processed in Sass.
Here's a rundown of the "supporting" stylesheets, that are unlikely to be the right place for a drive by stylesheet fix:
File | Description
: | :
_variables.scss | Variables to allow easier definition of widget sizing/styling.
_color-palette.scss | Material Design color palette definitions. We don't recommend editing this unless Google updates the color scheme.
_colors.scss | Global color definitions. We keep the number of defined colors to a necessary minimum. 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.
_common*.scss | Actual definitions of style for each widget. This is where you are likely to add/remove your changes.
_apps*.scss _extensions.scss | App/extension specific stylings.
You can read about Sass on its web page.
Once you make your changes to the SCSS files, run the ./parse-sass.sh script
to rebuild the CSS files.
SVG
In Materia, to keep it maintainable, SVG files are basically edited on text-based. So if you just want to change the colors of SVG files, it is recommended to use a text editor instead of a image editor.
Several SVG files are used to render the PNG assets. Once you make your changes
to the SVG files, run the ./render-assets.sh script to render the PNG assets.
How to change the color scheme
Script
To easily change the color scheme, you can use the change_color.sh script (or
just use the oomox app).
Originally,
change_color.shandscripts/*.shwere implemented for oomox, but you can also run it on the command line without the app.
Note: This script doesn't support Chrome extensions for now.
For example, to change the color scheme to the previous Flat-Plat, run the script as follows:
For bash:
./change_color.sh -o Flat-Plat <(echo -e "BG=F5F5F5\nFG=212121\nMATERIA_VIEW=FFFFFF\nMATERIA_SURFACE=FAFAFA\nHDR_BG=455A64\nHDR_FG=FFFFFF\nSEL_BG=42A5F5\n")
For fish:
./change_color.sh -o Flat-Plat (echo -e "BG=F5F5F5\nFG=212121\nMATERIA_VIEW=FFFFFF\nMATERIA_SURFACE=FAFAFA\nHDR_BG=455A64\nHDR_FG=FFFFFF\nSEL_BG=42A5F5\n" | psub)
Manual
If you want to change the color scheme in more detail, edit the files where colors are defined.
SCSS
src/_sass/_color-palette.scsssrc/_sass/_colors.scss
Note: Do not forget to run
./parse-sass.shafter changing the colors of SCSS files.
SVG
src/gtk/assets.svgsrc/gtk-2.0/assets{,-dark}.svgsrc/gnome-shell/assets{,-dark}/*.svgsrc/unity/*.svgsrc/unity/assets{,-light}/*.svgsrc/xfwm4/assets{,-light}/*.svgsrc/chrome/chrome-scrollbar{,-dark}/icons/*.svgsrc/chrome/chrome-theme{,-dark,-light}/*.svg
Note: Do not forget to run
./render-assets.shafter changing the colors ofsrc/gtk/assets.svgandsrc/gtk-2.0/assets{,-dark}.svg.
Misc
src/gtk-2.0/gtkrc{,-dark,-light}src/metacity-1/metacity-theme-2{,-light}.xmlsrc/xfwm4/assets{,-light}/themercsrc/chrome/chrome-theme{,-dark,-light}/manifest.json
Note: The colors of
manifest.jsonare defined in RGB format, so you need to convert your colors from HEX format to RGB format.
After all the steps, run ./install.sh to rebuild the themes.
Useful Links
Upstream theme sources
GTK 4.0 (master)
GTK 3 (3.24)
Sass sources (legacy)
Metacity (legacy)
For other upstream theme sources of apps/DEs, see the comments in the source code.
Tips
1
## Summary
2
3
- Do not edit the CSS directly, edit the source SCSS files and run `./parse-sass.sh`.
4
- You'll need to have `sassc` installed.
5
- Do not edit the PNG directly, edit the source SVG files and run `./render-assets.sh`.
6
- You'll need to have `inkscape` and `optipng` installed.
7
- To change the colors of SVG files, use a text editor instead of a image editor.
8
9
## How to tweak the theme
10
11
### SCSS
12
13
Like the upstream Adwaita, to keep it maintainable it's written and processed in
14
Sass.
15
16
Here's a rundown of the "supporting" stylesheets, that are unlikely to be the
17
right place for a drive by stylesheet fix:
18
19
File | Description
20
:-- | :--
21
`_variables.scss` | Variables to allow easier definition of widget sizing/styling.
22
`_color-palette.scss` | Material Design color palette definitions. We don't recommend editing this unless Google updates the color scheme.
23
`_colors.scss` | Global color definitions. We keep the number of defined colors to a necessary minimum. It covers both the light variant and the dark variant.
24
`_colors-public.scss` | SCSS colors exported through GTK to allow for 3rd party apps color mixing.
25
`_drawing*.scss` | Drawing helper mixings/functions to allow easier definition of widget drawing under specific context.
26
`_common*.scss` | Actual definitions of style for each widget. This is where you are likely to add/remove your changes.
27
`_apps*.scss` <br> `_extensions.scss` | App/extension specific stylings.
28
29
You can read about Sass on its [web page](http://sass-lang.com/documentation/).
30
Once you make your changes to the SCSS files, run the `./parse-sass.sh` script
31
to rebuild the CSS files.
32
33
### SVG
34
35
In Materia, to keep it maintainable, SVG files are basically edited on
36
text-based. So if you just want to change the colors of SVG files, it is
37
recommended to use a **text editor** instead of a image editor.
38
39
Several SVG files are used to render the PNG assets. Once you make your changes
40
to the SVG files, run the `./render-assets.sh` script to render the PNG assets.
41
42
## How to change the color scheme
43
44
### Script
45
46
To easily change the color scheme, you can use the `change_color.sh` script (or
47
just use the [oomox](https://github.com/themix-project/oomox) app).
48
49
> Originally, `change_color.sh` and `scripts/*.sh` were implemented for oomox,
50
but you can also run it on the command line without the app.
51
52
> Note: This script doesn't support Chrome extensions for now.
53
54
For example, to change the color scheme to the previous Flat-Plat, run the
55
script as follows:
56
57
For `bash`:
58
59
```bash
60
./change_color.sh -o Flat-Plat <(echo -e "BG=F5F5F5\nFG=212121\nMATERIA_VIEW=FFFFFF\nMATERIA_SURFACE=FAFAFA\nHDR_BG=455A64\nHDR_FG=FFFFFF\nSEL_BG=42A5F5\n")
61
```
62
63
For `fish`:
64
65
```fish
66
./change_color.sh -o Flat-Plat (echo -e "BG=F5F5F5\nFG=212121\nMATERIA_VIEW=FFFFFF\nMATERIA_SURFACE=FAFAFA\nHDR_BG=455A64\nHDR_FG=FFFFFF\nSEL_BG=42A5F5\n" | psub)
67
```
68
69
### Manual
70
71
If you want to change the color scheme in more detail, edit the files where
72
colors are defined.
73
74
#### SCSS
75
76
- `src/_sass/_color-palette.scss`
77
- `src/_sass/_colors.scss`
78
79
> Note: Do not forget to run `./parse-sass.sh` after changing the colors of SCSS
80
files.
81
82
#### SVG
83
84
- `src/gtk/assets.svg`
85
- `src/gtk-2.0/assets{,-dark}.svg`
86
- `src/gnome-shell/assets{,-dark}/*.svg`
87
- `src/unity/*.svg`
88
- `src/unity/assets{,-light}/*.svg`
89
- `src/xfwm4/assets{,-light}/*.svg`
90
- `src/chrome/chrome-scrollbar{,-dark}/icons/*.svg`
91
- `src/chrome/chrome-theme{,-dark,-light}/*.svg`
92
93
> Note: Do not forget to run `./render-assets.sh` after changing the colors of
94
`src/gtk/assets.svg` and `src/gtk-2.0/assets{,-dark}.svg`.
95
96
#### Misc
97
98
- `src/gtk-2.0/gtkrc{,-dark,-light}`
99
- `src/metacity-1/metacity-theme-2{,-light}.xml`
100
- `src/xfwm4/assets{,-light}/themerc`
101
- `src/chrome/chrome-theme{,-dark,-light}/manifest.json`
102
103
> Note: The colors of `manifest.json` are defined in RGB format, so you need to
104
convert your colors from HEX format to RGB format.
105
106
After all the steps, run `./install.sh` to rebuild the themes.
107
108
## Useful Links
109
110
### Upstream theme sources
111
112
- [GTK 4.0](https://gitlab.gnome.org/GNOME/gtk/tree/master/gtk/theme/Adwaita) (master)
113
- [GTK 3](https://gitlab.gnome.org/GNOME/gtk/tree/gtk-3-24/gtk/theme/Adwaita) (3.24)
114
- [GTK 2](https://gitlab.gnome.org/GNOME/gnome-themes-extra/tree/master/themes/Adwaita/gtk-2.0)
115
- [GNOME Shell](https://gitlab.gnome.org/GNOME/gnome-shell/tree/master/data/theme)
116
- [Sass sources](https://gitlab.gnome.org/GNOME/gnome-shell-sass) (legacy)
117
- [Metacity](https://gitlab.gnome.org/GNOME/gnome-themes-extra/tree/gnome-3-14/themes/Adwaita/metacity-1) (legacy)
118
119
> For other upstream theme sources of apps/DEs, see the comments in the source code.
120
121
### Tips
122
123
- [Material Design Guidelines](https://www.material.io/guidelines/)
124
- [CSS Guidelines for Materia](https://github.com/nana-4/materia-theme/wiki/CSS-Guidelines)
125
- [The GTK Inspector](https://blog.gtk.org/2017/04/05/the-gtk-inspector/)
126
- [Theming in GTK 4](https://developer.gnome.org/gtk4/stable/theming.html)
127
- [Theming in GTK 3](https://developer.gnome.org/gtk3/stable/theming.html)
128
- [GTK 2 Theming Tutorial](https://wiki.gnome.org/Attic/GnomeArt/Tutorials/GtkThemes)
129
- [The Pixmap Engine](https://wiki.gnome.org/Attic/GnomeArt/Tutorials/GtkEngines/PixmapEngine)
130
- [Designing Metacity Themes](https://wiki.gnome.org/Attic/GnomeArt/Tutorials/MetacityThemes)
131
- [Unity/Theming](https://wiki.ubuntu.com/Unity/Theming)
132
- [Xfwm4 theme how-to](https://wiki.xfce.org/howto/xfwm4_theme)
133
- [Chrome Themes](https://developer.chrome.com/extensions/themes)
134