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.53 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-dark: $blue;
55
$primary-light: #7BAAF7;
56
$primary: if($variant == 'light', $primary-dark, $primary-light);
57
58
$background: if($variant == 'light', #F2F2F2, #282828);
59
$surface: if($variant == 'light', #FFFFFF, #424242);
60
$base: if($variant == 'light', #FFFFFF, #303030); // semi-surface with no elevation
61
$base-alt: if($variant == 'light', #FAFAFA, #2C2C2C);
62
63
$os-background: #303030;
64
$tooltip: rgba(#616161, 0.9);
65
$scrim: rgba(black, 0.6);
66
$scrim-alt: rgba(black, 0.3);
67
$scrim-inverse: rgba(white, 0.1);
68
$titlebar: if($topbar == 'dark', #383838, #E0E0E0);
69
$titlebar-backdrop: if($topbar == 'dark', #303030, #D6D6D6);
70
$panel: if($topbar == 'dark', #212121, $scrim);
71
$panel-solid: if($topbar == 'dark', #212121, #CCCCCC); // for Unity panel which doesn't allow translucent colors
72
73
//
74
// Misc colors
75
//
76
77
$link: $primary;
78
$link-visited: $purple-a200;
79
80
$warning: $yellow;
81
$error: $red;
82
$success: $green;
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, 0.24);
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
$track-disabled: on($background, track-disabled);
112
$divider: on($background, divider);
113
$fill: on($background, fill);
114
115
$titlebar-text: on($titlebar);
116
$titlebar-text-secondary: on($titlebar, secondary);
117
$titlebar-text-disabled: on($titlebar, disabled);
118
$titlebar-text-secondary-disabled: on($titlebar, secondary-disabled);
119
$titlebar-track: on($titlebar, track);
120
$titlebar-track-disabled: on($titlebar, track-disabled);
121
$titlebar-divider: on($titlebar, divider);
122
$titlebar-fill: on($titlebar, fill);
123
124
// workaround for GTK3 @placeholder_text_color which doesn't allow translucent colors
125
$placeholder_text_color: if($variant == 'light', $grey-600, mix($white, $base, percentage(0.7)));
126