Oldiewaita/source/common/buttons.scss

151 lines
3.3 KiB
SCSS

//auxiliary functions for buttons first
$_default_button_c: $button_bg;
@mixin button($t, $c:$button_bg, $tc:$button_fg, $edge: none, $backimage: null) {
//
// Button drawing function
//
// $t: button type,
// $c: base button color for colored* types
// $tc: optional text color for colored* types
// $edge: set to none to not draw the bottom edge or specify a color to not
// use the default one
// $backimage: additional background-image behind the default one
// (for the button.circular hack)
//
// possible $t values (gtk3):
// normal, hover, active, insensitive, insensitive-active,
// backdrop, backdrop-active, backdrop-insensitive, backdrop-insensitive-active,
// osd, osd-hover, osd-active, osd-insensitive, osd-backdrop, undecorated
// possible $t values (gtk4):
// normal, hover, active, checked-hover, checked-active, insensitive, insensitive-active,
// backdrop, backdrop-active, backdrop-insensitive, backdrop-insensitive-active,
// osd, osd-hover, osd-active, osd-insensitive, osd-backdrop, undecorated
// this mixin needs to cover both gtk3 and gtk4 cases in order to work.
// gtk4 mixin calls only include $t, $c and $tc, therefore it should be safe to use in both.
border-width: $border_width;
@if $t==normal or $t==normal-alt {
//
// normal button
//
color: $tc;
@include relief($c);
}
@else if $t==hover or $t==hover-alt or $t==undecorated-hover {
//
// hovered button
//
@include relief(lighten($c, 5%));
}
@else if ($t==active) {
//
// pushed button
//
//color: $button_checked_fg;
//background-color: $button_checked_bg;
@include relief($c, sunken);
}
@else if ($t==checked-active ) {
//
// pushed and toggled button
//
color: $button_checked_fg;
@include relief($button_checked_bg, sunken);
}
@else if ($t==checked-hover) {
//
// toggled button and hover
//
color: $button_checked_fg;
@include relief(lighten($button_checked_bg, 5%), sunken);
}
@else if $t==insensitive or $t==osd-insensitive {
//
// insensitive button
//
color: $insensitive_fg_color;
@include relief($insensitive_bg_color);
@extend %disabled_pattern;
}
@else if $t==insensitive-active {
//
// insensitive pushed button
//
color: $insensitive_fg_color;
@include relief(mix($insensitive_bg_color, $button_checked_bg, 85%), sunken);
@extend %disabled_pattern;
}
@else if $t==backdrop {
//
// backdrop button
//
//background-image: if($backimage==null, none, $backimage);
}
@else if $t==backdrop-active {
//
// backdrop pushed button
//
}
@else if $t==backdrop-insensitive {
//
// backdrop insensitive button
//
}
@else if $t==backdrop-insensitive-active {
//
// backdrop insensitive pushed button
//
}
//OSD buttons
@else if $t==osd {
color: $osd_fg_color;
@include relief($osd_bg_color);
}
@else if $t==osd-hover {
color: $osd_fg_color;
@include relief(lighten($osd_bg_color,5%));
}
@else if $t==osd-active {
color: $osd_fg_color;
@include relief(lighten($osd_bg_color,5%),sunken);
}
@else if $t==undecorated {
//
// reset
//
border-color: transparent;
background-color: transparent;
background-image: none;
text-shadow: none;
-gtk-icon-shadow: none;
}
}