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