A fork of the Materia GTK theme.

Important information: Google announced that, from September 2026, Android devices will require ALL apps to be signed by Google, effectively leading to an iOS situation. Value your right to a computer that does what you want; do not tolerate this monopolistic practice! Contact me if you don't understand why it is bad. Click to learn more.

 _colors.scss.template

View raw Download
text/plain • 5.28 kiB
ASCII text
        
            
1
// When color definition differs for dark and light variant,
2
// it gets @if ed depending on $variant
3
4
@import 'color-palette';
5
6
@function gtkalpha($c, $a) {
7
@return unquote("alpha(#{$c}, #{$a})");
8
}
9
10
@function on($color, $state: 'primary') {
11
// Allow 'light' or 'dark' to $color
12
@if ($color == 'light') { $color: white; }
13
@if ($color == 'dark') { $color: black; }
14
15
// Calculate color brightness according to https://www.w3.org/TR/AERT/#color-contrast
16
$brightness: (red($color) * 299 + green($color) * 587 + blue($color) * 114) / 1000;
17
18
@if ($brightness >= 128) {
19
@if ($state == 'primary') { @return rgba(black, 0.87); }
20
@if ($state == 'secondary') { @return rgba(black, 0.54); }
21
@if ($state == 'disabled') { @return rgba(black, 0.38); }
22
@if ($state == 'secondary-disabled') { @return rgba(black, 0.26); }
23
@if ($state == 'track') { @return rgba(black, 0.26); }
24
@if ($state == 'track-disabled') { @return rgba(black, 0.12); }
25
@if ($state == 'divider') { @return rgba(black, 0.12); }
26
@if ($state == 'fill') { @return rgba(black, 0.04); }
27
} @else {
28
@if ($state == 'primary') { @return white; }
29
@if ($state == 'secondary') { @return rgba(white, 0.7); }
30
@if ($state == 'disabled') { @return rgba(white, 0.5); }
31
@if ($state == 'secondary-disabled') { @return rgba(white, 0.3); }
32
@if ($state == 'track') { @return rgba(white, 0.3); }
33
@if ($state == 'track-disabled') { @return rgba(white, 0.12); }
34
@if ($state == 'divider') { @return rgba(white, 0.12); }
35
@if ($state == 'fill') { @return rgba(white, 0.04); }
36
}
37
}
38
39
@function highlight($color) {
40
@if (lightness($color) >= 80%) { @return rgba(white, 0.4); }
41
@else if (lightness($color) >= 40%) { @return rgba(white, 0.2); }
42
@else { @return rgba(white, 0.1); }
43
}
44
45
//
46
// Basic colors
47
//
48
49
$blue: %TERMINAL_COLOR12%;
50
$green: %TERMINAL_COLOR10%;
51
$yellow: %TERMINAL_COLOR11%;
52
$red: %TERMINAL_COLOR9%;
53
54
$primary-dark: %SEL_BG%;
55
$primary-light: %SEL_BG%;
56
$primary: if($variant == 'light', $primary-dark, $primary-light);
57
58
$background: %BG%;
59
$surface: %MATERIA_SURFACE%;
60
$base: %MATERIA_VIEW%;
61
$base-alt: %INACTIVE_MATERIA_VIEW%;
62
63
$os-background: %HDR_BG3%;
64
$tooltip: rgba(%HDR_BG%, 0.9);
65
$scrim: rgba(black, %MATERIA_PANEL_OPACITY%);
66
$scrim-alt: rgba(black, 0.3);
67
$scrim-inverse: rgba(white, 0.1);
68
$titlebar: %HDR_BG%;
69
$titlebar-backdrop: %HDR_BG2%;
70
$panel: if($topbar == 'dark', %HDR_BG3%, $scrim);
71
$panel-solid: %HDR_BG3%; // for Unity panel which doesn't allow translucent colors
72
73
//
74
// Misc colors
75
//
76
77
$link: $primary;
78
$link-visited: %TERMINAL_COLOR5%;
79
80
$warning: %TERMINAL_COLOR11%;
81
$error: %TERMINAL_COLOR9%;
82
$success: %TERMINAL_COLOR10%;
83
84
$suggested: $primary-dark;
85
$destructive: $error;
86
87
$frame: if($variant == 'light', rgba(black, 0.12), rgba(black, 0.26)); // instead of shadows
88
$border-alt: rgba(black, 0.26); // darker border color for Chrome and Firefox
89
$titlebar-indicator: if($topbar == 'dark', currentColor, $primary);
90
91
//
92
// Overlay state colors
93
//
94
95
$overlay-hover: gtkalpha(currentColor, 0.08);
96
$overlay-focus: gtkalpha(currentColor, 0.08);
97
$overlay-focus-hover: gtkalpha(currentColor, 0.16);
98
$overlay-active: gtkalpha(currentColor, 0.12);
99
$overlay-checked: gtkalpha(currentColor, 0.12);
100
$overlay-selected: rgba($primary, %MATERIA_SELECTION_OPACITY%);
101
102
//
103
// Text and derivative colors
104
//
105
106
$text: %FG%;
107
$text-secondary: rgba(%FG%, 0.7);
108
$text-disabled: rgba(%FG%, 0.5);
109
$text-secondary-disabled: rgba(%FG%, 0.3);
110
$track: rgba(%FG%, 0.3);
111
$track-disabled: rgba(%FG%, 0.12);
112
$divider: rgba(%FG%, 0.12);
113
$fill: rgba(%FG%, 0.04);
114
115
$titlebar-text: %HDR_FG%;
116
$titlebar-text-secondary: rgba(%HDR_FG%, 0.7);
117
$titlebar-text-disabled: rgba(%HDR_FG%, 0.5);
118
$titlebar-text-secondary-disabled: rgba(%HDR_FG%, 0.3);
119
$titlebar-track: rgba(%HDR_FG%, 0.3);
120
$titlebar-track-disabled: rgba(%HDR_FG%, 0.12);
121
$titlebar-divider: rgba(%HDR_FG%, 0.12);
122
$titlebar-fill: rgba(%HDR_FG%, 0.04);
123
124
// workaround for GTK3 @placeholder_text_color which doesn't allow translucent colors
125
$placeholder_text_color: mix(%FG%, $base, percentage(0.7));
126