numix-gtk-theme/gtk-3.0/scss/_functions.scss

68 lines
1.7 KiB
SCSS
Raw Normal View History

2014-11-23 17:06:45 +00:00
$modules: () !default;
@mixin exports($name) {
2015-08-06 23:10:35 +00:00
@if (not index($modules, $name)) {
$modules: append($modules, $name) !global;
2014-12-14 12:22:13 +00:00
2015-08-06 23:10:35 +00:00
@content;
}
2014-11-23 17:06:45 +00:00
}
2014-07-05 19:54:53 +00:00
@function shade($color, $amount) {
2015-08-06 23:10:35 +00:00
@if type-of($color) == "color" {
@if ($amount > 1) {
@return lighten($color, ($amount - 1) * lightness($color))
} @else {
@return darken($color, (1 - $amount) * lightness($color))
}
} @else {
@return unquote("shade(#{$color},#{$amount})");
}
2014-07-05 19:54:53 +00:00
}
@function border_normal($color) {
2015-08-06 23:10:35 +00:00
@return shade($color, $contrast);
2014-07-05 19:54:53 +00:00
}
@function border_focus($color) {
2015-08-06 23:10:35 +00:00
@return shade($color, ($contrast - .05));
2014-07-05 19:54:53 +00:00
}
@function border_active($color) {
2015-08-06 23:10:35 +00:00
@return shade($color, ($contrast - .1));
2014-07-05 19:54:53 +00:00
}
@function border_insensitive($color) {
2015-08-06 23:10:35 +00:00
@return shade($color, ($contrast + .05));
2014-07-05 19:54:53 +00:00
}
@mixin linear-gradient($color, $direction: to bottom) {
2015-08-06 23:10:35 +00:00
@if $gradient == 0 {
background-color: $color;
background-image: none;
} @else {
$amount: $gradient / 2;
background-color: $color;
background-image: linear-gradient($direction,
shade($color, (1 + $amount)),
shade($color, (1 - $amount))
);
}
2014-07-05 19:54:53 +00:00
}
@mixin border($color) {
2015-08-06 23:10:35 +00:00
border-color: border_normal($color);
2014-07-05 19:54:53 +00:00
2015-08-06 23:10:35 +00:00
&:focus, &:hover { border-color: border_focus($color); }
2014-07-05 19:54:53 +00:00
2015-08-06 23:10:35 +00:00
&:active, &:active:hover,
&:active:focus, &:active:hover:focus,
&:checked, &:checked:hover,
&:checked:focus, &:checked:hover:focus { border-color: border_active($color); }
2014-07-05 19:54:53 +00:00
2015-08-06 23:10:35 +00:00
&:insensitive { border-color: border_insensitive($color); }
2014-07-05 19:54:53 +00:00
2015-08-06 23:10:35 +00:00
&:active:insensitive, &:checked:insensitive { border-color: border_normal($color); }
}