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.54 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: #4285F4;
50
$green: #34A853;
51
$yellow: #FBBC05;
52
$red: #EA4335;
53
54
$primary: $blue;
55
$primary-alt: #7BAAF7;
56
57
$background: if($variant == 'light', #F2F2F2, #282828);
58
$surface: if($variant == 'light', #FFFFFF, #424242);
59
$base: if($variant == 'light', #FFFFFF, #303030); // semi-surface with no elevation
60
$base-alt: if($variant == 'light', #FAFAFA, #2C2C2C);
61
62
$os-background: #303030;
63
$tooltip: rgba(#616161, 0.9);
64
$scrim: rgba(black, 0.6);
65
$scrim-alt: rgba(black, 0.3);
66
$scrim-inverse: rgba(white, 0.1);
67
$titlebar: if($topbar == 'dark', #383838, #E0E0E0);
68
$panel: if($topbar == 'dark', #212121, $scrim);
69
$panel-solid: if($topbar == 'dark', #212121, #CBCBCB); // for Unity panel which doesn't allow translucent colors
70
71
//
72
// Misc colors
73
//
74
75
$link: $primary;
76
$link-visited: $purple-a200;
77
78
$warning: $yellow;
79
$error: $red;
80
$success: $green;
81
82
$suggested: $primary;
83
$destructive: $error;
84
85
$infobar-info: $green;
86
$infobar-question: $blue;
87
$infobar-warning: $warning;
88
$infobar-error: $error;
89
90
$frame: if($variant == 'light', rgba(black, 0.12), rgba(black, 0.26)); // instead of shadows
91
$border-alt: rgba(black, 0.26); // darker border color for Chrome and Firefox
92
$titlebar-indicator: if($topbar == 'dark', currentColor, $primary);
93
94
//
95
// Overlay state colors
96
//
97
98
$overlay-hover: gtkalpha(currentColor, 0.08);
99
$overlay-focus: gtkalpha(currentColor, 0.12);
100
$overlay-focus-hover: gtkalpha(currentColor, 0.16);
101
$overlay-active: gtkalpha(currentColor, 0.12);
102
$overlay-checked: gtkalpha(currentColor, 0.12);
103
$overlay-selected: rgba($primary, 0.24);
104
105
//
106
// Text and derivative colors
107
//
108
109
$text: on($background);
110
$text-secondary: on($background, secondary);
111
$text-disabled: on($background, disabled);
112
$text-secondary-disabled: on($background, secondary-disabled);
113
$track: on($background, track);
114
$track-disabled: on($background, track-disabled);
115
$divider: on($background, divider);
116
$fill: on($background, fill);
117
118
$titlebar-text: on($titlebar);
119
$titlebar-text-secondary: on($titlebar, secondary);
120
$titlebar-text-disabled: on($titlebar, disabled);
121
$titlebar-text-secondary-disabled: on($titlebar, secondary-disabled);
122
$titlebar-track: on($titlebar, track);
123
$titlebar-track-disabled: on($titlebar, track-disabled);
124
$titlebar-divider: on($titlebar, divider);
125
$titlebar-fill: on($titlebar, fill);
126
127
// workaround for GTK3 @placeholder_text_color which doesn't allow translucent colors
128
$placeholder_text_color: if($variant == 'light', $grey-600, mix($white, $base, percentage(0.7)));
129