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

View raw Download
text/plain • 5.67 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
@if ($color == 'light') { $color: white; }
12
@if ($color == 'dark') { $color: black; }
13
14
// Calculate color brightness according to https://www.w3.org/TR/AERT/#color-contrast
15
$brightness: (red($color) * 299 + green($color) * 587 + blue($color) * 114) / 1000;
16
17
@if ($brightness >= 128) {
18
@if ($state == 'primary') { @return rgba(black, 0.87); }
19
@if ($state == 'secondary') { @return rgba(black, 0.54); }
20
@if ($state == 'disabled') { @return rgba(black, 0.38); }
21
@if ($state == 'secondary-disabled') { @return rgba(black, 0.26); }
22
@if ($state == 'track') { @return rgba(black, 0.26); }
23
@if ($state == 'divider') { @return rgba(black, 0.12); }
24
@if ($state == 'fill') { @return rgba(black, 0.04); }
25
} @else {
26
@if ($state == 'primary') { @return white; }
27
@if ($state == 'secondary') { @return rgba(white, 0.7); }
28
@if ($state == 'disabled') { @return rgba(white, 0.5); }
29
@if ($state == 'secondary-disabled') { @return rgba(white, 0.3); }
30
@if ($state == 'track') { @return rgba(white, 0.3); }
31
@if ($state == 'divider') { @return rgba(white, 0.12); }
32
@if ($state == 'fill') { @return rgba(white, 0.04); }
33
}
34
}
35
36
@function highlight($color) {
37
@if (lightness($color) > 80%) { @return rgba(white, 0.4); }
38
@else if (lightness($color) > 40%) { @return rgba(white, 0.2); }
39
@else { @return rgba(white, 0.1); }
40
}
41
42
//
43
// Basic colors
44
//
45
46
$blue: #4285F4;
47
$green: #34A853;
48
$yellow: #FBBC05;
49
$red: #EA4335;
50
51
$primary: $blue;
52
$primary-alt: #7BAAF7;
53
54
$background: if($variant == 'light', #F2F2F2, #282828);
55
$surface: if($variant == 'light', #FFFFFF, #424242);
56
$base: if($variant == 'light', #FFFFFF, #303030);
57
$base-alt: if($variant == 'light', #FAFAFA, #2C2C2C);
58
59
$os-background: #303030;
60
$tooltip: rgba(#616161, 0.9);
61
$scrim: rgba(black, 0.6);
62
$scrim-alt: rgba(black, 0.3);
63
$scrim-inverse: rgba(white, 0.1);
64
$titlebar: if($topbar == 'dark', #383838, #E0E0E0);
65
$panel: if($topbar == 'dark', #212121, $scrim);
66
$panel-solid: if($topbar == 'dark', #212121, #CBCBCB); // for Unity panel which doesn't allow translucent colors
67
68
//
69
// Misc colors
70
//
71
72
$link: $primary;
73
$link-visited: $purple-a200;
74
75
$warning: $yellow;
76
$error: $red;
77
$success: $green;
78
79
$suggested: $primary;
80
$destructive: $error;
81
82
$infobar-info: $green;
83
$infobar-question: $blue;
84
$infobar-warning: $warning;
85
$infobar-error: $error;
86
87
$border: if($variant == 'light', rgba(black, 0.12), rgba(black, 0.26));
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.12);
97
$overlay-focus-hover: gtkalpha(currentColor, 0.16);
98
$overlay-active: gtkalpha(currentColor, 0.12);
99
$overlay-checked: gtkalpha(currentColor, 0.24);
100
$overlay-selected: rgba($primary, 0.32);
101
102
//
103
// Text and derivative colors
104
//
105
106
$text: on($background);
107
$text-secondary: on($background, secondary);
108
$text-disabled: on($background, disabled);
109
$text-secondary-disabled: on($background, secondary-disabled);
110
$track: on($background, track);
111
$divider: on($background, divider);
112
$fill: on($background, fill);
113
114
$titlebar-text: on($titlebar);
115
$titlebar-text-secondary: on($titlebar, secondary);
116
$titlebar-text-disabled: on($titlebar, disabled);
117
$titlebar-text-secondary-disabled: on($titlebar, secondary-disabled);
118
$titlebar-track: on($titlebar, track);
119
$titlebar-divider: on($titlebar, divider);
120
$titlebar-fill: on($titlebar, fill);
121
122
// workaround for Electron menu which doesn't allow translucent colors
123
$solid-text: if($variant == 'light', $grey-900, $white);
124
$solid-text-secondary: if($variant == 'light', $grey-600, mix($white, $surface, percentage(0.7)));
125
$solid-text-disabled: if($variant == 'light', $grey-500, mix($white, $surface, percentage(0.5)));
126
$solid-divider: if($variant == 'light', $grey-300, mix($white, $surface, percentage(0.12)));
127
128
// workaround for GTK3 @placeholder_text_color which doesn't allow translucent colors
129
$placeholder_text_color: if($variant == 'light', $grey-600, mix($white, $base, percentage(0.7)));
130