aboutsummaryrefslogtreecommitdiff
path: root/common/gtk-3.0/3.16/_drawing.scss
blob: 9fcdfbc1cf15a97741063ef7edd1f06056945475 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
// Drawing mixins

// generic drawing of more complex things

@mixin _shadows($shadow1, $shadow2:none, $shadow3:none, $shadow4:none) {
//
// Helper function to stack up to 4 box-shadows;
//

  @if $shadow4!=none { box-shadow: $shadow1, $shadow2, $shadow3, $shadow4; }
  @else if $shadow3!=none { box-shadow: $shadow1, $shadow2, $shadow3; }
  @else if $shadow2!=none { box-shadow: $shadow1, $shadow2; }
  @else { box-shadow: $shadow1; }
}

// Entries

@mixin entry($t) {
//
// Entries drawing function
//
// $t: entry type
//

  @if $t==normal {
  //
  // normal entry
  //
    color: $text_color;
    border-color: $entry_border;
    background-color: $entry_bg;
    background-image: linear-gradient(to bottom, $entry_bg);
  }

  @if $t==focus {
  //
  // focused entry
  //
    color: $text_color;
    border-color: $selected_bg_color;
    background-color: $entry_bg;
    background-image: linear-gradient(to bottom, $entry_bg);
  }

  @if $t==insensitive {
  //
  // insensitive entry
  //
    color: $insensitive_fg_color;
    border-color: transparentize($entry_border, 0.45);
    background-color: transparentize($entry_bg, 0.45);
    background-image: linear-gradient(to bottom, transparentize($entry_bg, 0.45));
  }

  @if $t==header-normal {
  //
  // normal header-bar entry
  //
    color: $header_fg;
    border-color: if($variant == 'light', transparentize($header_fg, 0.7), darken($borders_color, 4%));
    background-image: linear-gradient(to bottom, if($variant == 'light', transparentize($base_color, 0.1), transparentize(darken($base_color, 4%), 0.1)));
    background-color: transparent;

    &.image, &.image:hover { color: inherit; }
  }

  @if $t==header-focus {
  //
  // focused header-bar entry
  //
    color: $selected_fg_color;
    border-color: $selected_bg_color;
    background-image: linear-gradient(to bottom, $selected_bg_color);
  }

  @if $t==header-insensitive {
  //
  // insensitive header-bar entry
  //
    color: transparentize($header_fg, 0.45);
    background-image: linear-gradient(to bottom, if($variant == 'light', transparentize($base_color, 0.45), transparentize(darken($base_color, 4%), 0.45)));
  }

  @if $t==osd {
    color: $osd_text_color;
    border-color: $osd_borders_color;
    background-image: linear-gradient(to bottom, transparentize(opacify($osd_borders_color, 1), 0.5));
    background-clip: padding-box;

    text-shadow: 0 1px black;
    icon-shadow: 0 1px black;
  }

  @if $t==osd-focus {
    color: $osd_text_color;
    border-color: $selected_bg_color;
    background-image: linear-gradient(to bottom, transparentize(opacify($osd_borders_color, 1), 0.5));
    background-clip: padding-box;

    text-shadow: 0 1px black;
    icon-shadow: 0 1px black;
  }

  @if $t==osd-insensitive {
    color: $osd_insensitive_fg_color;
    border-color: $osd_borders_color;
    background-image: linear-gradient(to bottom, $osd_insensitive_bg_color);
    background-clip: padding-box;

    text-shadow: none;
    icon-shadow: none;
  }
}

// Buttons

@mixin button($t) {
//
// Button drawing function
//
// $t:    button type,
//

  @if $t==normal {
  //
  // normal button
  //
    color: $fg_color;
    outline-color: transparentize($fg_color, 0.7);
    border-color: $button_border;
    background-color: $button_bg;
  }

  @else if $t==hover {
  //
  // hovered button
  //
    color: $fg_color;
    outline-color: transparentize($fg_color, 0.7);
    border-color: $selected_bg_color;
    background-color: $button_bg;
  }

  @else if $t==active {
  //
  // pushed button
  //
    color: $selected_fg_color;
    outline-color: transparentize($selected_fg_color, 0.7);
    border-color: $selected_bg_color;
    background-color: $selected_bg_color;
  }

  @else if $t==insensitive {
  //
  // insensitive button
  //
    color: $insensitive_fg_color;
    border-color: transparentize($button_border, 0.45);
    background-color: transparentize($button_bg, 0.45);

    > GtkLabel { color: inherit; }
  }

  @else if $t==insensitive-active {
  //
  // insensitive pushed button
  //
    color: transparentize($selected_fg_color, 0.45);
    border-color: transparentize($selected_bg_color, 0.45);
    background-color: transparentize($selected_bg_color, 0.45);

    opacity: 0.6;

    > GtkLabel { color: inherit; }
  }

  @if $t==header-normal {
  //
  // normal header-bar button
  //
    color: $header_fg;
    outline-color: transparentize($header_fg, 0.7);
    outline-offset: -3px;
    background-color: transparentize($header_bg, 1);
    border-color: transparentize($header_bg, 1);
  }

  @else if $t==header-hover {
  //
  // hovered header-bar button
  //
    color: $header_fg;
    outline-color: transparentize($header_fg, 0.7);
    border-color: if($variant == 'light', transparentize($header_fg, 0.7), darken($borders_color, 4%));
    background-color: if($variant == 'light', transparentize($button_bg, 0.1), transparentize(darken($button_bg, 4%), 0.1));
  }

  @else if $t==header-active {
  //
  // pushed header-bar button
  //
    color: $selected_fg_color;
    outline-color: transparentize($selected_fg_color, 0.7);
    border-color: $selected_bg_color;
    background-color: $selected_bg_color;
  }

  @else if $t==header-insensitive {
  //
  // insensitive header-bar button
  //
    color: transparentize($header_fg, 0.45);
    background-color: transparentize($header_bg, 1);
    border-color: transparentize($header_bg, 1);

    > GtkLabel { color: inherit; }
  }

  @else if $t==header-insensitive-active {
  //
  // header-bar insensitive pushed button
  //
    color: transparentize($selected_fg_color, 0.25);
    border-color: transparentize($selected_bg_color, 0.35);
    background-color: transparentize($selected_bg_color, 0.35);
  }

  @else if $t==osd {
  //
  // normal osd button
  //
    color: $osd_fg_color;
    outline-color: transparentize($osd_fg_color, 0.7);
    border-color: transparentize($osd_fg_color, 0.7);
    background-color: transparent;
    background-image: linear-gradient(to bottom, darken($osd_bg_color, 5%));
  }

  @else if $t==osd-hover {
  //
  // active osd button
  //
    color: $selected_bg_color;
    outline-color: transparentize($osd_fg_color, 0.7);
    border-color: $selected_bg_color;
    background-image: linear-gradient(to bottom, darken($osd_bg_color, 5%));
  }

  @else if $t==osd-active {
  //
  // active osd button
  //
    color: $selected_fg_color;
    outline-color: transparentize($selected_fg_color, 0.7);
    border-color: $selected_bg_color;
    background-image: linear-gradient(to bottom, $selected_bg_color);
  }

  @else if $t==osd-insensitive {
  //
  // insensitive osd button
  //
    color: $osd_insensitive_fg_color;
    border-color: transparentize($osd_fg_color, 0.8);
    background-image: linear-gradient(to bottom, $osd_insensitive_bg_color);
  }

  @else if $t==undecorated {
  //
  // reset
  //
    border-color: transparent;
    background-color: transparent;
    background-image: none;
  }
}

//
// Overshoot
//
@mixin overshoot($p, $c:$selected_bg_color) {
// $p: position
// $c: base color
//
// possible $p values:
// top, bottom, right, left
//

  $_big_gradient_length: 60%;

  $_position: center top;
  $_big_gradient_size: 100% $_big_gradient_length;

  @if $p==bottom {
    $_position: center bottom;
  }

  @else if $p==right {
    $_position: right center;
    $_big_gradient_size: $_big_gradient_length 100%;
  }

  @else if $p==left {
    $_position: left center;
    $_big_gradient_size: $_big_gradient_length 100%;
  }

  background-image: -gtk-gradient(radial,
                                $_position, 0,
                                $_position, 0.6,
                                from(transparentize($c, 0.8)),
                                to(transparentize($c, 1)));

  background-size: $_big_gradient_size;
  background-repeat: no-repeat;
  background-position: $_position;

  background-color: transparent; // reset some properties to be sure to not inherit them somehow
  border: none;                  //
  box-shadow: none;              //
}

//
// Undershoot
//
@mixin undershoot($p) {
// $p: position
//
// possible $p values:
// top, bottom, right, left
//

  $_undershoot_color_dark: transparentize(black, 0.8);
  $_undershoot_color_light: transparentize(white, 0.8);

  $_gradient_dir: left;
  $_dash_bg_size: 10px 1px;
  $_gradient_repeat: repeat-x;
  $_bg_pos: center $p;

  background-color: transparent; // shouldn't be needed, but better to be sure;

  @if ($p == left) or ($p == right) {
    $_gradient_dir: top;
    $_dash_bg_size: 1px 10px;
    $_gradient_repeat: repeat-y;
    $_bg_pos: $p center;
  }

  background-image: linear-gradient(to $_gradient_dir, // this is the dashed line
                                    $_undershoot_color_light 50%,
                                    $_undershoot_color_dark 50%);

  padding-#{$p}: 1px;
  background-size: $_dash_bg_size;
  background-repeat: $_gradient_repeat;
  background-origin: content-box;
  background-position: $_bg_pos;
}