numix-gtk-theme/gtk-3.0/scss/widgets/_button.scss

269 lines
6.2 KiB
SCSS
Raw Normal View History

2014-11-23 17:06:45 +00:00
/*********
! Buttons
**********/
2014-07-05 19:54:53 +00:00
2014-12-14 11:47:14 +00:00
@include exports("button_extends") {
%button {
padding: ($spacing - 1px) ($spacing + 1px);
2014-07-05 19:54:53 +00:00
border-width: 1px;
2014-12-14 11:47:14 +00:00
border-style: solid;
2014-07-05 19:54:53 +00:00
border-radius: $roundness;
2014-12-14 11:47:14 +00:00
transition: 100ms ease;
outline-color: transparent;
2014-12-14 11:47:14 +00:00
-GtkWidget-focus-padding: 1;
-GtkWidget-focus-line-width: 0;
2014-07-05 19:54:53 +00:00
}
2014-12-14 11:47:14 +00:00
%linked_button {
2014-07-05 19:54:53 +00:00
border-width: 1px;
2014-12-14 11:47:14 +00:00
border-style: solid;
border-radius: 0;
border-right-style: none;
border-left-style: none;
2014-12-14 11:47:14 +00:00
&:first-child {
border-width: 1px;
border-radius: $roundness;
border-left-style: solid;
border-right-style: none;
2014-12-14 11:47:14 +00:00
border-top-right-radius: 0;
border-bottom-right-radius: 0;
&:dir(rtl) {
border-left-style: none;
border-right-style: solid;
}
}
2014-07-05 19:54:53 +00:00
2014-12-14 11:47:14 +00:00
&:last-child {
border-width: 1px;
border-radius: $roundness;
border-left-style: none;
border-right-style: solid;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
&:dir(rtl) {
border-left-style: solid;
border-right-style: none;
}
}
&:only-child, &:first-child:only-child {
border-width: 1px;
border-style: solid;
border-radius: $roundness;
}
2014-07-05 19:54:53 +00:00
}
2014-12-13 14:17:53 +00:00
}
@mixin linked_button($bg) {
@extend %linked_button;
box-shadow: inset -1px 0 border_normal($bg),
0 1px 2px -1px alpha($dark_shadow, .3);
2014-07-05 19:54:53 +00:00
&:focus, &:hover {
box-shadow: inset -1px 0 border_focus($bg),
2014-12-13 14:17:53 +00:00
0 1px 2px -1px alpha($dark_shadow, .3);
}
2014-07-05 19:54:53 +00:00
&:active, &:active:hover,
2014-11-23 17:06:45 +00:00
&:active:focus, &:active:hover:focus,
&:checked, &:checked:hover,
&:checked:focus, &:checked:hover:focus {
2014-07-05 19:54:53 +00:00
box-shadow: inset -1px 0 border_active($bg),
2014-12-13 14:17:53 +00:00
inset 1px 0 alpha($dark_shadow, .07),
inset 0 1px alpha($dark_shadow, .08),
inset 0 -1px alpha($dark_shadow, .05);
2014-07-05 19:54:53 +00:00
}
&:insensitive { box-shadow: inset -1px 0 border_insensitive($bg); }
&:last-child, &:only-child,
&:insensitive:last-child, &:insensitive:only-child,
&:active:insensitive:last-child, &:active:insensitive:only-child,
&:checked:insensitive:last-child, &:checked:insensitive:only-child { box-shadow: none; }
2014-07-05 19:54:53 +00:00
2014-11-23 17:06:45 +00:00
&:active:last-child, &:active:only-child,
2014-12-13 14:17:53 +00:00
&:active:last-child:focus, &:active:only-child:focus,
&:active:last-child:hover, &:active:only-child:hover,
&:active:last-child:hover:focus, &:active:only-child:hover:focus,
&:checked:last-child, &:checked:only-child,
&:checked:last-child:focus, &:checked:only-child:focus,
&:checked:last-child:hover, &:checked:only-child:hover,
&:checked:last-child:hover:focus, &:checked:only-child:hover:focus {
box-shadow: inset 1px 0 alpha($dark_shadow, .07),
inset 0 1px alpha($dark_shadow, .08),
inset -1px 0 alpha($dark_shadow, .07);
2014-07-05 19:54:53 +00:00
}
}
@mixin button($bg, $fg) {
@include linear-gradient(shade($bg, 1.05));
2014-12-13 14:17:53 +00:00
@extend %button;
2014-07-05 19:54:53 +00:00
color: $fg;
box-shadow: 0 1px 2px -1px alpha($dark_shadow, .3);
2014-07-05 19:54:53 +00:00
&:insensitive {
@include linear-gradient(shade($bg, .95));
color: mix($bg, $fg, .5);
box-shadow: none;
2014-07-05 19:54:53 +00:00
}
2014-12-13 14:35:09 +00:00
&, &.flat {
@include border(shade($bg, 1.05));
&:focus, &:hover {
@include linear-gradient(shade($bg, 1.1));
box-shadow: 0 1px 3px -1px alpha($dark_shadow, .5);
}
&:checked, &:active {
@include linear-gradient(shade($bg, .95));
box-shadow: inset 1px 0 alpha($dark_shadow, .07),
inset 0 1px alpha($dark_shadow, .08),
inset -1px 0 alpha($dark_shadow, .07),
inset 0 -1px alpha($dark_shadow, .05);
}
&:active:insensitive,
&:checked:insensitive {
@include linear-gradient(shade($bg, .8));
2014-07-05 19:54:53 +00:00
2014-12-13 14:35:09 +00:00
box-shadow: none;
}
}
&.flat {
color: inherit;
border-color: transparent;
background-color: transparent;
background-image: none;
2014-07-05 19:54:53 +00:00
box-shadow: none;
}
&.separator, .separator {
2014-12-13 14:35:09 +00:00
border: 1px solid currentColor;
2014-12-08 19:47:23 +00:00
color: shade($bg, ($contrast + .05));
2014-07-05 19:54:53 +00:00
&:insensitive { color: shade($bg, .85); }
}
}
@include exports("button") {
%close_button {
border: 1px solid transparent;
background-color: transparent;
background-image: none;
box-shadow: none;
&:focus, &:hover {
border: 1px solid alpha(black, 0.3);
background-color: alpha(white, 0.2);
background-image: none;
box-shadow: none;
}
&:active, &:checked, &:active:hover, &:checked:hover {
border: 1px solid alpha(black, 0.3);
background-color: alpha(black, 0.1);
background-image: none;
box-shadow: none;
}
}
.button {
@include button($bg_color, $fg_color);
2014-07-05 19:54:53 +00:00
&.default { @include button($selected_bg_color, $selected_fg_color); }
2014-12-08 20:08:40 +00:00
2014-12-14 11:47:14 +00:00
&.linked, .linked & { @include linked_button($bg_color); }
2014-12-13 14:17:53 +00:00
2014-12-08 20:08:40 +00:00
.spinbutton & {
color: mix($text_color, $base_color, 0.4);
2014-12-13 14:17:53 +00:00
padding: $spacing ($spacing * 2);
border: none;
2014-12-08 20:08:40 +00:00
border-radius: 0;
border-style: none;
background-color: transparent;
background-image: none;
box-shadow: inset 1px 0 shade($base_color, 0.9);
&:insensitive {
color: mix($text_color, $base_color, 0.7);
2014-12-14 11:47:14 +00:00
box-shadow: inset 1px 0 shade($base_color, 0.85);
2014-12-08 20:08:40 +00:00
}
&:active, &:checked, &:hover { color: $text_color; }
&:first-child {
border-radius: $roundness 0 0 $roundness;
box-shadow: none;
}
&:last-child { border-radius: 0 $roundness $roundness 0; }
&:dir(rtl) { box-shadow: inset -1px 0 shade($base_color, 0.9); }
}
.spinbutton.vertical & {
2014-12-14 11:47:14 +00:00
border: 1px solid shade($bg_color, 0.8);
border-radius: $roundness;
background-color: shade($bg_color, 1.08);
background-image: none;
color: $fg_color;
box-shadow: none;
2014-12-08 20:08:40 +00:00
&:hover {
border-color: shade($bg_color, 0.7);
background-color: shade($bg_color, 1.10);
background-image: none;
}
&:active, &:checked {
border-color: shade($bg_color, 0.8);
background-color: shade($bg_color, 0.95);
background-image: none;
}
&:active:hover, &:checked:hover {
border-color: shade($bg_color, 0.7);
}
&:focus, &:hover:focus, &:active:focus, &:active:hover:focus { border-color: shade($bg_color, 0.7); }
&:insensitive {
border-color: shade($bg_color, 0.85);
background-color: shade($bg_color, 0.9);
background-image: none;
}
&:first-child {
border-width: 1px;
border-bottom-width: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
&:last-child {
border-width: 1px;
border-top-width: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
}
.spinbutton.vertical.entry {
border-width: 1px;
border-style: solid;
border-radius: 0;
}
}
}