2014-06-13 14:32:44 +00:00
|
|
|
// Drawing mixins
|
|
|
|
|
|
|
|
// generic drawing of more complex things
|
|
|
|
|
|
|
|
$widget_edge: 0 1px $borders_edge; //outer hilight "used" on
|
|
|
|
//most widgets
|
|
|
|
|
|
|
|
@mixin _shadows($shadow1, $shadow2:none, $shadow3:none, $shadow4:none) {
|
|
|
|
//
|
|
|
|
// Helper function to stack up to 4 box-shadows;
|
|
|
|
//
|
|
|
|
@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; }
|
|
|
|
}
|
|
|
|
|
|
|
|
// entries
|
|
|
|
|
2014-07-03 10:29:25 +00:00
|
|
|
@mixin entry($t, $fc:$selected_bg_color, $noedge:false) {
|
2014-06-13 14:32:44 +00:00
|
|
|
//
|
|
|
|
// Entries drawing function
|
|
|
|
//
|
|
|
|
// $t: entry type
|
2014-07-03 10:29:25 +00:00
|
|
|
// $fc: focus color
|
2014-06-13 14:32:44 +00:00
|
|
|
// $noedge: set to true not to draw the bottom edge hilight
|
|
|
|
//
|
|
|
|
// possible $t values:
|
|
|
|
// normal, focus, insensitive, backdrop, backdrop-insensitive;
|
|
|
|
//
|
|
|
|
background-color: transparent;
|
|
|
|
border-style: solid;
|
|
|
|
border-width: 1px;
|
|
|
|
background-image: linear-gradient(to bottom,
|
|
|
|
darken($base_color,3%),
|
|
|
|
$base_color 90%);
|
2014-07-07 15:21:52 +00:00
|
|
|
// we need to match the same shadow types (inset/outset) in various states
|
|
|
|
// hence transparent shadows istead of resetting them when not needed
|
|
|
|
$_blank_inner_shadows: inset 0 2px 2px -2px transparentize(
|
|
|
|
mix(black, $base_color, 50%),1),
|
|
|
|
inset 0 0 2px 1px transparentize(
|
2014-07-07 17:51:27 +00:00
|
|
|
mix($fc,$base_color,20%),1);
|
2014-07-07 15:21:52 +00:00
|
|
|
$_blank_edge: if($noedge, none, 0 1px transparentize(white,1));
|
|
|
|
|
2014-06-13 14:32:44 +00:00
|
|
|
$_entry_edge: $widget_edge;
|
|
|
|
@if $noedge { $_entry_edge: none; }
|
|
|
|
|
|
|
|
@if $t==normal {
|
|
|
|
border-color: $borders_color;
|
|
|
|
@include _shadows(inset 0 2px 2px -2px mix(black, $base_color, 50%),
|
2014-07-07 17:51:27 +00:00
|
|
|
inset 0 0 2px 1px transparentize(
|
|
|
|
mix($fc,$base_color,20%),1),
|
2014-06-13 14:32:44 +00:00
|
|
|
$_entry_edge);
|
2014-07-07 15:21:52 +00:00
|
|
|
// the second transparent shadow is needed for the transition to work
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
@if $t==focus {
|
|
|
|
@if $variant == 'light' {
|
2014-07-03 10:29:25 +00:00
|
|
|
border-color: $fc;
|
2014-06-13 14:32:44 +00:00
|
|
|
@include _shadows(inset 0 2px 2px -2px mix(black, $base_color, 50%),
|
2014-07-05 16:18:44 +00:00
|
|
|
inset 0 0 2px 1px mix($fc,$base_color,20%),
|
2014-06-13 14:32:44 +00:00
|
|
|
$_entry_edge);
|
|
|
|
}
|
|
|
|
@else {
|
2014-07-03 10:29:25 +00:00
|
|
|
border-color: if($fc==$selected_bg_color,
|
|
|
|
$selected_borders_color,
|
|
|
|
darken($fc,35%));
|
2014-06-13 14:32:44 +00:00
|
|
|
@include _shadows(inset 0 2px 2px -2px mix(black, $base_color, 50%),
|
2014-07-03 10:29:25 +00:00
|
|
|
inset 0 0 1px 1px $fc,
|
2014-06-13 14:32:44 +00:00
|
|
|
$_entry_edge);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@if $t==insensitive {
|
|
|
|
color: $insensitive_fg_color;
|
|
|
|
border-color: $borders_color;
|
|
|
|
background-image: linear-gradient(to bottom, $insensitive_bg_color);
|
2014-07-07 15:21:52 +00:00
|
|
|
@include _shadows($_blank_inner_shadows, $_entry_edge);
|
|
|
|
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
@if $t==backdrop {
|
|
|
|
color: $backdrop_fg_color;
|
|
|
|
background-image: linear-gradient(to bottom, $backdrop_base_color);
|
2014-07-07 15:21:52 +00:00
|
|
|
@include _shadows($_blank_inner_shadows, $_blank_edge);
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
@if $t==backdrop-insensitive {
|
|
|
|
color: $backdrop_insensitive_color;
|
|
|
|
background-image: linear-gradient(to bottom, $backdrop_bg_color);
|
2014-07-07 15:21:52 +00:00
|
|
|
@include _shadows($_blank_inner_shadows, $_blank_edge);
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// buttons
|
|
|
|
|
2014-07-07 12:26:58 +00:00
|
|
|
@function _border_color ($c) { @return darken($c,25%); } // colored buttons want the border form the base color
|
2014-06-13 14:32:44 +00:00
|
|
|
|
|
|
|
@mixin _button_text_shadow ($tc:$fg_color, $bg:$bg_color) {
|
|
|
|
//
|
|
|
|
// helper function for the text emboss effect
|
|
|
|
//
|
|
|
|
// $tc is the optional text color, not the shadow color
|
|
|
|
//
|
|
|
|
// TODO: this functions needs a way to deal with special cases
|
|
|
|
//
|
|
|
|
|
|
|
|
$_lbg: lightness($bg)/100%;
|
|
|
|
|
|
|
|
$_dark: transparentize(black,$_lbg*0.8);
|
|
|
|
$_bright: transparentize(white,1-$_lbg/($_lbg*1.3));
|
|
|
|
|
|
|
|
@if lightness($tc) < 50% {
|
|
|
|
text-shadow: 0 1px $_bright;
|
|
|
|
icon-shadow: 0 1px $_bright;
|
|
|
|
}
|
|
|
|
@else {
|
|
|
|
text-shadow: 0 -1px $_dark;
|
|
|
|
icon-shadow: 0 -1px $_dark;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin button($t, $c:$bg_color, $tc:$fg_color, $noedge:false ) {
|
|
|
|
//
|
|
|
|
// Button drawing function
|
|
|
|
//
|
|
|
|
// $t: button type,
|
|
|
|
// $c: base button color for colored* types
|
|
|
|
// $tc: optional text color for colored* types
|
|
|
|
// $noedge: set to true not to draw the bottom edge hilight
|
|
|
|
//
|
|
|
|
// possible $t values:
|
|
|
|
// normal, hover, active, insensitive, insensitive-active,
|
2014-07-08 16:24:28 +00:00
|
|
|
// backdrop, backdrop-active, backdrop-insensitive, backdrop-insensitive-active,
|
2014-07-08 16:28:02 +00:00
|
|
|
// osd, osd-hover, osd-active, osd-insensitive, undecorated
|
2014-06-13 14:32:44 +00:00
|
|
|
//
|
|
|
|
border-style: solid;
|
|
|
|
|
|
|
|
$_top_hilight: if(lightness($c)> 70%, white, transparentize(white,0.9)); //not just dark/light but colored buttons
|
|
|
|
|
|
|
|
@if $t==normal {
|
2014-07-07 11:26:09 +00:00
|
|
|
|
2014-06-13 14:32:44 +00:00
|
|
|
//
|
|
|
|
// normal button
|
|
|
|
//
|
2014-07-07 11:26:09 +00:00
|
|
|
border-width: 1px;
|
2014-06-13 14:32:44 +00:00
|
|
|
color: $tc;
|
2014-06-18 14:36:00 +00:00
|
|
|
background-image: linear-gradient(to bottom,
|
2014-06-13 14:32:44 +00:00
|
|
|
lighten($c,5%),
|
|
|
|
$c 40%,
|
|
|
|
darken($c,5%)
|
|
|
|
);
|
|
|
|
|
2014-07-07 12:26:58 +00:00
|
|
|
@if $c!=$bg_color { border-color: _border_color($c); }
|
2014-06-13 14:32:44 +00:00
|
|
|
@else { border-color: $borders_color; }
|
|
|
|
|
|
|
|
@include _button_text_shadow($tc,$c);
|
2014-07-10 09:55:51 +00:00
|
|
|
$_outsets: if($noedge, none, $widget_edge);
|
|
|
|
@include _shadows(inset 0 1px $_top_hilight, $_outsets);
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@else if $t==hover {
|
|
|
|
//
|
|
|
|
// hovered button
|
|
|
|
//
|
|
|
|
color: $tc;
|
2014-07-07 12:26:58 +00:00
|
|
|
@if $c!=$bg_color { border-color: _border_color($c); }
|
2014-06-13 14:32:44 +00:00
|
|
|
@else { border-color: $borders_color; }
|
|
|
|
background-image: linear-gradient(to bottom,
|
|
|
|
lighten($c,14%),
|
|
|
|
lighten($c,4%) 40%,
|
|
|
|
$c);
|
|
|
|
|
|
|
|
@include _button_text_shadow($tc,lighten($c,4%));
|
2014-07-10 09:55:51 +00:00
|
|
|
$_outsets: if($noedge, none, $widget_edge);
|
|
|
|
@include _shadows(inset 0 1px $_top_hilight, $_outsets);
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@else if $t==active {
|
|
|
|
//
|
|
|
|
// pushed button
|
|
|
|
//
|
|
|
|
color: $tc;
|
2014-07-07 12:26:58 +00:00
|
|
|
@if $c!=$bg_color {border-color: _border_color($c); }
|
2014-06-13 14:32:44 +00:00
|
|
|
@else { border-color: $borders_color; }
|
|
|
|
@if $variant == 'light' {
|
|
|
|
background-image: linear-gradient(to bottom,
|
|
|
|
darken($c,15%),
|
|
|
|
darken($c,11%) 3%,
|
|
|
|
darken($c,10%));
|
|
|
|
}
|
|
|
|
@else {
|
|
|
|
background-image: linear-gradient(to bottom,
|
|
|
|
darken($c,10%),
|
|
|
|
darken($c,5%) 3%);
|
|
|
|
}
|
|
|
|
@include _button_text_shadow($tc,darken($c,10%));
|
2014-07-10 09:55:51 +00:00
|
|
|
$_outsets: if($noedge, none, $widget_edge);
|
|
|
|
@include _shadows(inset 0 2px 3px -1px transparentize(black,0.7),$_outsets);
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
@else if $t==insensitive {
|
|
|
|
//
|
|
|
|
// insensitive button
|
|
|
|
//
|
|
|
|
color: $insensitive_fg_color;
|
|
|
|
border-color: $insensitive_borders_color;
|
|
|
|
background-image: linear-gradient(to bottom, $insensitive_bg_color);
|
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
2014-07-10 09:55:51 +00:00
|
|
|
$_outsets: if($noedge, none, $widget_edge);
|
|
|
|
// white with 0 alpha to avoid an ugly transition, since no color means
|
|
|
|
// black with 0 alpha
|
|
|
|
@include _shadows(inset 0 1px transparentize(white,1), $_outsets);
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
@else if $t==insensitive-active {
|
|
|
|
//
|
|
|
|
// insensitive pushed button
|
|
|
|
//
|
|
|
|
color: $insensitive_fg_color;
|
|
|
|
border-color: $insensitive_borders_color;
|
|
|
|
background-image: linear-gradient(to bottom,
|
|
|
|
mix($insensitive_borders_color,
|
|
|
|
$insensitive_bg_color, 10%));
|
2014-07-10 09:55:51 +00:00
|
|
|
$_outsets: if($noedge, none, $widget_edge);
|
|
|
|
// white with 0 alpha to avoid an ugly transition, since no color means
|
|
|
|
// black with 0 alpha
|
|
|
|
@include _shadows(inset 0 1px transparentize(white,1), $_outsets);
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@else if $t==backdrop {
|
|
|
|
//
|
|
|
|
// backdrop button
|
|
|
|
//
|
2014-06-17 13:55:58 +00:00
|
|
|
color: if($c!=$bg_color, $tc, $backdrop_fg_color);
|
2014-06-13 14:32:44 +00:00
|
|
|
border-color: if($c!=$bg_color, $c, $backdrop_borders_color);
|
|
|
|
background-image: linear-gradient(to bottom,
|
|
|
|
if($c!=bg_color,$c,$backdrop_bg_color));
|
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
|
|
|
@include _shadows(inset 0 1px transparentize(white,1),
|
2014-07-10 09:55:51 +00:00
|
|
|
0 1px transparentize(white,1));
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@else if $t==backdrop-active {
|
|
|
|
//
|
|
|
|
// backdrop pushed button
|
|
|
|
//
|
|
|
|
color: $backdrop_fg_color;
|
|
|
|
border-color: $backdrop_borders_color;
|
|
|
|
background-image: linear-gradient(to bottom,
|
|
|
|
mix($backdrop_borders_color,$backdrop_bg_color, 35%));
|
2014-07-10 09:55:51 +00:00
|
|
|
box-shadow: inset 0 1px transparentize(white,1),
|
|
|
|
0 1px transparentize(white,1);
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@else if $t==backdrop-insensitive {
|
|
|
|
//
|
|
|
|
// backdrop insensitive button
|
|
|
|
//
|
|
|
|
color: $backdrop_insensitive_color;
|
|
|
|
border-color: $backdrop_borders_color;
|
|
|
|
background-image: linear-gradient(to bottom, $backdrop_bg_color);
|
2014-07-10 09:55:51 +00:00
|
|
|
box-shadow: inset 0 1px transparentize(white,1),
|
|
|
|
0 1px transparentize(white,1);
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@else if $t==backdrop-insensitive-active {
|
|
|
|
//
|
|
|
|
// backdrop insensitive pushed button
|
|
|
|
//
|
|
|
|
color: $backdrop_insensitive_color;
|
|
|
|
border-color: $backdrop_borders_color;
|
|
|
|
background-image: linear-gradient(to bottom,
|
|
|
|
mix($backdrop_borders_color,$backdrop_bg_color, 8%));
|
2014-07-10 09:55:51 +00:00
|
|
|
box-shadow: inset 0 1px transparentize(white,1),
|
|
|
|
0 1px transparentize(white,1);
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@else if $t==osd {
|
|
|
|
//
|
|
|
|
// normal osd button
|
|
|
|
//
|
2014-07-07 11:26:09 +00:00
|
|
|
background-image: linear-gradient(to bottom, $osd_bg_color);
|
2014-06-13 14:32:44 +00:00
|
|
|
border-color: $osd_borders_color;
|
|
|
|
box-shadow: none;
|
|
|
|
}
|
|
|
|
@else if $t==osd-hover {
|
|
|
|
//
|
|
|
|
// active osd button
|
|
|
|
//
|
2014-07-07 11:26:09 +00:00
|
|
|
background-image: linear-gradient(to bottom, lighten($osd_bg_color,10%));
|
2014-06-13 14:32:44 +00:00
|
|
|
border-color: $osd_borders_color;
|
|
|
|
box-shadow: none;
|
|
|
|
}
|
|
|
|
@else if $t==osd-active {
|
|
|
|
//
|
|
|
|
// active osd button
|
|
|
|
//
|
2014-07-07 11:26:09 +00:00
|
|
|
background-image: linear-gradient(to bottom, lighten($osd_bg_color,20%));
|
2014-06-13 14:32:44 +00:00
|
|
|
border-color: $osd_borders_color;
|
|
|
|
box-shadow: none;
|
|
|
|
}
|
|
|
|
@else if $t==osd-insensitive {
|
|
|
|
//
|
|
|
|
// insensitive osd button
|
|
|
|
//
|
|
|
|
border-color: $osd_borders_color;
|
|
|
|
color: $insensitive_fg_color;
|
|
|
|
}
|
2014-07-08 16:24:28 +00:00
|
|
|
|
|
|
|
@else if $t==undecorated {
|
|
|
|
border-color: transparent;
|
|
|
|
background-color: transparent;
|
|
|
|
background-image: none;
|
|
|
|
box-shadow: inset 0 1px transparentize(white,1);
|
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
|
|
|
}
|
2014-06-13 14:32:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@mixin trough($flat:false, $c:$bg_color, $tc:$fg_color, $noedge:false) {
|
|
|
|
color: mix($tc,$bg_color,80%);
|
|
|
|
@if $flat { background-image: linear-gradient(to bottom,$c); }
|
|
|
|
@else {
|
|
|
|
background-image: linear-gradient(to bottom,
|
|
|
|
mix(black,$c,15%) 5%,
|
|
|
|
mix(black,$c,10%) 20%,
|
|
|
|
mix(black,$c,10%) 90%,
|
|
|
|
$c
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-07-07 12:26:58 +00:00
|
|
|
@if $c!=$bg_color { border-color: _border_color($c); }
|
2014-06-13 14:32:44 +00:00
|
|
|
@else { border-color: $borders_color; }
|
|
|
|
|
|
|
|
@if $noedge==false {
|
|
|
|
@if lightness($c) > 60% {
|
|
|
|
box-shadow: inset 0 -1px 0 $borders_edge,
|
|
|
|
0 1px 0 $borders_edge;
|
|
|
|
}
|
|
|
|
@else {
|
|
|
|
box-shadow: inset 0 -1px 0 transparentize($borders_edge,0.5),
|
|
|
|
0 1px 0 transparentize($borders_edge,0.5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|