Files
Colloid-gtk-theme/src/sass/gtk/_drawing-4.0.scss
vinceliuice ac2053c721 update
2022-10-10 13:45:44 +08:00

245 lines
5.7 KiB
SCSS

// generic drawing of more complex things
@mixin entry($t, $fc: $primary) {
//
// entry
//
// $t: entry type
// $fc: focus color
//
@if $t == normal {
transition: $transition, box-shadow $ripple-fade-out-duration $ease-out;
box-shadow: inset 0 0 0 2px transparent;
background-color: if($fc == $primary, $entry, rgba($fc, 0.1));
color: if($fc == $primary, $text-secondary, rgba($fc, 0.75));
}
@if $t == hover {
background-color: $overlay-hover;
box-shadow: inset 0 0 0 2px $overlay-hover;
color: if($fc == $primary, $text, $fc);
}
@if $t == focus {
background-color: $overlay-focus;
box-shadow: inset 0 0 0 2px if($fc == $primary, $track, $fc);
color: if($fc == $primary, $text, $fc);
}
@if $t == checked {
background-color: if($fc == $primary, $entry, rgba($fc, 0.1));
box-shadow: inset 0 0 0 2px if($fc == $primary, $primary, $fc);
color: if($fc == $primary, $text, $fc);
}
@if $t == disabled {
box-shadow: inset 0 0 0 2px transparent;
background-color: if($fc == $primary, $entry, rgba($fc, 0.1));
color: if($fc == $primary, $text-disabled, rgba($fc, 0.35));
}
@if $t == raised-normal {
transition: $transition, box-shadow $ripple-fade-out-duration $ease-out;
border-image: none;
box-shadow: inset 0 0 0 2px transparent;
background-color: if($fc == $primary, $surface, $fc);
color: if($fc == $primary, $text, on($fc));
}
@if $t == raised-hover {
box-shadow: inset 0 0 0 2px $overlay-hover;
}
@if $t == raised-focus {
border-image: none;
box-shadow: inset 0 0 0 2px if($fc == $primary, $primary, $fc);
}
@if $t == raised-disabled {
box-shadow: inset 0 0 0 2px transparent;
background-color: $base-alt;
color: $text-disabled;
}
}
@mixin button($t) {
//
// button
//
// $t: button type
//
@if $t == normal {
transition: $transition,
background-color $ripple-fade-in-duration $ease-out;
outline: none;
background-color: $button;
color: $text;
}
@if $t == hover {
background-color: $overlay-hover;
}
@if $t == focus {
box-shadow: 0 0 0 2px rgba($primary, 0.35);
}
@if $t == active {
transition: $transition,
background-color $ripple-fade-in-duration $ease-out;
background-color: $overlay-active;
}
@if $t == disabled {
box-shadow: none;
background-color: $fill;
color: $text-disabled;
}
@if $t == checked {
background-color: $primary;
color: on($primary);
}
@if $t == checked-hover {
box-shadow: none;
}
@if $t == checked-disabled {
box-shadow: none;
background-color: rgba($primary, 0.35);
color: on($primary, disabled);
}
@if $t == flat-normal {
transition: $transition,
background-color $ripple-fade-in-duration $ease-out;
outline: none;
background-color: transparent;
color: $text-secondary;
}
@if $t == flat-hover {
background-color: $overlay-hover;
color: $text;
box-shadow: none;
}
@if $t == flat-focus {
background-color: transparent;
color: $text;
box-shadow: inset 0 0 0 2px $fill;
}
@if $t == flat-active {
transition: $transition,
background-color $ripple-fade-in-duration $ease-out;
background-color: $overlay-active;
color: $text;
box-shadow: none;
}
@if $t == flat-disabled {
color: $text-secondary-disabled;
}
@if $t == flat-checked {
background-color: $overlay-checked;
color: $text;
box-shadow: none;
}
@if $t == flat-checked-disabled {
background-color: $overlay-checked;
color: $text-disabled;
}
}
@mixin overshoot($p) {
//
// overshoot
//
// $p: position
//
// possible $p values:
// top, bottom, right, left
//
$_small_gradient_length: 3%;
$_big_gradient_length: 50%;
$_small_gradient_size: 100% $_small_gradient_length;
$_big_gradient_size: 100% $_big_gradient_length;
@if $p==right or $p==left {
$_small_gradient_size: $_small_gradient_length 100%;
$_big_gradient_size: $_big_gradient_length 100%;
}
$_small_gradient: radial-gradient(farthest-side at $p,
gtkalpha(currentColor, 0.12) 85%,
gtkalpha(currentColor, 0));
$_big_gradient: radial-gradient(farthest-side at $p,
gtkalpha(currentColor, 0.05),
gtkalpha(currentColor, 0));
background-image: $_small_gradient, $_big_gradient;
background-size: $_small_gradient_size, $_big_gradient_size;
background-repeat: no-repeat;
background-position: $p;
background-color: transparent; // reset some properties to be sure to not inherit them somehow
border: none; //
box-shadow: none; //
}
@mixin undershoot($p) {
//
// undershoot
//
// $p: position
//
// possible $p values:
// top, bottom, right, left
//
$_undershoot_color_dark: $track;
$_undershoot_color_light: transparent;
$_gradient_dir: left;
$_dash_bg_size: 12px 1px;
$_gradient_repeat: repeat-x;
$_bg_pos: left $p;
@if ($p == left) or ($p == right) {
$_gradient_dir: top;
$_dash_bg_size: 1px 12px;
$_gradient_repeat: repeat-y;
$_bg_pos: $p top;
}
background-color: transparent; // shouldn't be needed, but better to be sure
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;
margin: 0 4px;
@if ($p == left) or ($p == right) {
margin: 4px 0;
}
}