one-dark/gtk-3.0/sass/var/drawing.scss

377 lines
8.5 KiB
SCSS
Raw Normal View History

2022-05-05 00:11:07 +08:00
// Drawing mixins
// generic drawing of more complex things
// Solid color image
@function _solid($c) {
@return linear-gradient(to bottom, $c, $c);
}
2022-05-13 18:38:41 +08:00
@mixin _shadows($shadow1, $shadow2: none, $shadow3: none, $shadow4: none) {
//
// Helper function to stack up to 4 box-shadows;
//
2022-05-05 00:11:07 +08:00
2022-05-13 18:38:41 +08:00
@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;
}
2022-05-05 00:11:07 +08:00
}
// Entries
@mixin entry($t) {
//
2022-05-13 18:38:41 +08:00
// Entries drawing function
2022-05-05 00:11:07 +08:00
//
2022-05-13 18:38:41 +08:00
// $t: entry type
//
@if $t==normal {
//
// normal entry
//
2022-05-05 00:11:07 +08:00
color: $text_color;
border-color: $entry_border;
background-color: $entry_bg;
}
@if $t==focus {
2022-05-13 18:38:41 +08:00
//
// focused entry
//
2022-05-05 00:11:07 +08:00
color: $text_color;
2022-05-13 18:38:41 +08:00
border-color: $button_border;
2022-05-05 00:11:07 +08:00
background-color: $entry_bg;
2022-05-13 18:38:41 +08:00
box-shadow: inset 1px 0 $selected_bg_color, inset -1px 0 $selected_bg_color,
inset 0 1px $selected_bg_color, inset 0 -1px $selected_bg_color;
2022-05-05 00:11:07 +08:00
}
@if $t==insensitive {
2022-05-13 18:38:41 +08:00
//
// insensitive entry
//
2022-05-05 00:11:07 +08:00
color: $insensitive_fg_color;
border-color: transparentize($entry_border, 0.45);
background-color: transparentize($entry_bg, 0.45);
}
@if $t==header-normal {
2022-05-13 18:38:41 +08:00
//
// normal header-bar entry
//
2022-05-05 00:11:07 +08:00
color: $header_fg;
border-color: $header_entry_border;
background-color: $header_entry_bg;
2022-05-13 18:38:41 +08:00
image,
image:hover {
color: inherit;
}
2022-05-05 00:11:07 +08:00
}
@if $t==header-focus {
2022-05-13 18:38:41 +08:00
//
// focused header-bar entry
//
2022-05-05 00:11:07 +08:00
color: $header_fg;
border-color: $selected_bg_color;
background-color: $header_entry_bg;
}
@if $t==header-insensitive {
2022-05-13 18:38:41 +08:00
//
// insensitive header-bar entry
//
2022-05-05 00:11:07 +08:00
color: transparentize($header_fg, 0.45);
background-color: transparentize($header_entry_bg, 0.15);
2022-05-13 18:38:41 +08:00
} @else if $t==osd {
//
// normal osd entry
//
2022-05-05 00:11:07 +08:00
color: $osd_fg_color;
border-color: $osd_entry_border;
background-color: $osd_entry_bg;
2022-05-13 18:38:41 +08:00
image,
image:hover {
color: inherit;
}
} @else if $t==osd-focus {
//
// active osd entry
//
2022-05-05 00:11:07 +08:00
color: $selected_fg_color;
border-color: $osd_entry_border;
background-color: $selected_bg_color;
2022-05-13 18:38:41 +08:00
} @else if $t==osd-insensitive {
//
// insensitive osd entry
//
2022-05-05 00:11:07 +08:00
color: transparentize($osd_fg_color, 0.45);
background-color: transparentize($osd_entry_bg, 0.15);
}
}
// Buttons
2022-05-13 18:38:41 +08:00
@mixin button($t, $actionb_color: red) {
2022-05-05 00:11:07 +08:00
//
2022-05-13 18:38:41 +08:00
// Button drawing function
2022-05-05 00:11:07 +08:00
//
2022-05-13 18:38:41 +08:00
// $t: button type,
// $actionb_color: used for destructive and suggested action buttons
@if $t==normal {
//
// normal button
//
2022-05-05 00:11:07 +08:00
color: $fg_color;
outline-color: transparentize($fg_color, 0.7);
border-color: $button_border;
background-color: $button_bg;
2022-05-13 18:38:41 +08:00
} @else if $t==hover {
//
// hovered button
//
2022-05-05 00:11:07 +08:00
color: $fg_color;
outline-color: transparentize($fg_color, 0.7);
border-color: $button_border;
background-color: lighten($button_bg, 5%);
2022-05-13 18:38:41 +08:00
} @else if $t==active {
//
// pushed button
//
2022-05-05 00:11:07 +08:00
color: $fg_color;
outline-color: transparentize($fg_color, 0.7);
border-color: $button_active_border;
background-color: $button_active_bg;
2022-05-13 18:38:41 +08:00
} @else if $t==insensitive {
//
// insensitive button
//
2022-05-05 00:11:07 +08:00
color: $insensitive_fg_color;
border-color: transparentize($button_border, 0.45);
background-color: transparentize($button_bg, 0.45);
2022-05-13 18:38:41 +08:00
label {
color: inherit;
}
} @else if $t==insensitive-active {
//
// insensitive pushed button
//
2022-05-05 00:11:07 +08:00
color: transparentize($fg_color, 0.2);
border-color: transparentize($button_active_border, 0.15);
background-color: transparentize($button_active_bg, 0.05);
opacity: 0.6;
2022-05-13 18:38:41 +08:00
label {
color: inherit;
}
2022-05-05 00:11:07 +08:00
}
@if $t==header-normal {
2022-05-13 18:38:41 +08:00
//
// normal header-bar button
//
2022-05-05 00:11:07 +08:00
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);
2022-05-13 18:38:41 +08:00
} @else if $t==header-hover {
//
// hovered header-bar button
//
2022-05-05 00:11:07 +08:00
color: $header_fg;
outline-color: transparentize($header_fg, 0.7);
border-color: $header_button_border;
background-color: $header_button_bg;
2022-05-13 18:38:41 +08:00
} @else if $t==header-active {
//
// pushed header-bar button
//
2022-05-05 00:11:07 +08:00
color: $header_fg;
outline-color: transparentize($header_fg, 0.7);
2022-05-13 18:38:41 +08:00
border-color: $header_button_border;
2022-05-05 00:11:07 +08:00
background-color: $button_active_bg;
2022-05-13 18:38:41 +08:00
} @else if $t==header-insensitive {
//
// insensitive header-bar button
//
2022-05-05 00:11:07 +08:00
color: transparentize($header_fg, 0.45);
background-color: transparentize($header_bg, 1);
border-color: transparentize($header_bg, 1);
2022-05-13 18:38:41 +08:00
label {
color: inherit;
}
} @else if $t==header-insensitive-active {
//
// header-bar insensitive pushed button
//
2022-05-05 00:11:07 +08:00
color: transparentize($fg_color, 0.2);
border-color: transparentize($button_active_border, 0.15);
background-color: transparentize($button_active_bg, 0.05);
2022-05-13 18:38:41 +08:00
} @else if $t==osd {
//
// normal osd button
//
2022-05-05 00:11:07 +08:00
color: $osd_fg_color;
outline-color: transparentize($osd_fg_color, 0.7);
border-color: $osd_button_border;
background-color: $osd_button_bg;
2022-05-13 18:38:41 +08:00
} @else if $t==osd-hover {
//
// active osd button
//
2022-05-05 00:11:07 +08:00
color: $osd_fg_color;
outline-color: transparentize($osd_fg_color, 0.7);
border-color: $osd_button_border;
background-color: opacify(lighten($osd_button_bg, 7%), 0.1);
2022-05-13 18:38:41 +08:00
} @else if $t==osd-active {
//
// active osd button
//
2022-05-05 00:11:07 +08:00
color: $osd_fg_color;
outline-color: transparentize($osd_fg_color, 0.7);
border-color: $osd_button_border;
background-color: transparentize(black, 0.85);
2022-05-13 18:38:41 +08:00
} @else if $t==osd-insensitive {
//
// insensitive osd button
//
2022-05-05 00:11:07 +08:00
color: $osd_insensitive_fg_color;
border-color: $osd_button_border;
background-color: transparentize($osd_button_bg, 0.15);
2022-05-13 18:38:41 +08:00
} @else if $t==suggested_destructive {
//
// suggested or destructive action buttons
//
2022-05-05 00:11:07 +08:00
background-clip: border-box;
color: $selected_fg_color;
outline-color: transparentize($selected_fg_color, 0.7);
background-color: $actionb_color;
border-color: $actionb_color;
2022-05-13 18:38:41 +08:00
} @else if $t==undecorated {
//
// reset
//
2022-05-05 00:11:07 +08:00
border-color: transparent;
background-color: transparent;
background-image: none;
}
}
//
// Titlebar circular buttons
//
@mixin draw_circle($c) {
2022-05-13 18:38:41 +08:00
background-image: -gtk-gradient(
radial,
center center,
0,
center center,
0.5,
to($c),
to(transparent)
);
2022-05-05 00:11:07 +08:00
}
//
// Overshoot
//
2022-05-13 18:38:41 +08:00
@mixin overshoot($p, $c: $selected_bg_color) {
// $p: position
// $c: base color
//
// possible $p values:
// top, bottom, right, left
//
2022-05-05 00:11:07 +08:00
$_big_gradient_length: 60%;
$_position: center top;
$_big_gradient_size: 100% $_big_gradient_length;
@if $p==bottom {
$_position: center bottom;
2022-05-13 18:38:41 +08:00
} @else if $p==right {
2022-05-05 00:11:07 +08:00
$_position: right center;
$_big_gradient_size: $_big_gradient_length 100%;
2022-05-13 18:38:41 +08:00
} @else if $p==left {
2022-05-05 00:11:07 +08:00
$_position: left center;
$_big_gradient_size: $_big_gradient_length 100%;
}
2022-05-13 18:38:41 +08:00
background-image: -gtk-gradient(
radial,
$_position,
0,
$_position,
0.6,
from(transparentize($c, 0.8)),
to(transparentize($c, 1))
);
2022-05-05 00:11:07 +08:00
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
2022-05-13 18:38:41 +08:00
border: none; //
box-shadow: none; //
2022-05-05 00:11:07 +08:00
}
//
// Undershoot
//
@mixin undershoot($p) {
2022-05-13 18:38:41 +08:00
// $p: position
//
// possible $p values:
// top, bottom, right, left
//
2022-05-05 00:11:07 +08:00
$_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;
}
2022-05-13 18:38:41 +08:00
background-image: linear-gradient(
to $_gradient_dir,
// this is the dashed line
$_undershoot_color_light 50%,
$_undershoot_color_dark 50%
);
2022-05-05 00:11:07 +08:00
padding-#{$p}: 1px;
background-size: $_dash_bg_size;
background-repeat: $_gradient_repeat;
background-origin: content-box;
background-position: $_bg_pos;
}