Warning, /plasma/breeze-gtk/src/_functions.scss is written in an unsupported language. File is not indexed.

0001 @charset "UTF-8";
0002 
0003 // GTK functions
0004 
0005 // escape string entirely
0006 @function gtk($str) {
0007         @return unquote("#{$str}_breeze");
0008 }
0009 
0010 // alpha function
0011 @function gtkalpha($c, $a) {
0012         @return unquote("alpha(#{$c},#{$a})");
0013 }
0014 
0015 // shade function
0016 @function gtkshade($c, $a) {
0017         @return unquote("shade(#{$c}_breeze,#{$a})");
0018 }
0019 
0020 // mix function
0021 @function gtkmix($c1, $c2, $m) {
0022         @return unquote("mix(#{$c1},#{$c2},#{$m})");
0023 }
0024 
0025 @function gtkoverlay($c1, $c2) {
0026         @return unquote("linear-gradient(#{$c2},#{$c2}),
0027                                         linear-gradient(#{$c1},#{$c1})");
0028 }
0029 
0030 @function gtkoverlayalpha($c1, $c2, $a) {
0031         $ca1: gtkalpha(#{$c1}, #{$a});
0032         $ca2: gtkalpha(#{$c2}, #{$a});
0033         @return unquote("linear-gradient(#{$ca2},#{$ca2}),
0034                                         linear-gradient(#{$ca1},#{$ca1})");
0035 }
0036 
0037 //
0038 // Theme color functions
0039 //
0040 
0041 // Button Color
0042 @function internal_b_color($c: normal) {
0043         @if $c == normal {
0044                 @return $ButtonBackgroundNormal;
0045         }
0046         @if $c == hover {
0047                 @return $ButtonDecorationHover;
0048         }
0049         @if $c == active {
0050                 @return $ButtonDecorationFocus;
0051         }
0052         @if $c == text {
0053                 @return $ButtonForegroundNormal;
0054         }
0055         @if $c == active-text {
0056                 @return $SelectionForegroundNormal;
0057         }
0058 }
0059 
0060 // Selection Color
0061 @function internal_s_color($c: normal) {
0062         @if $c == normal {
0063                 @return $SelectionBackgroundNormal;
0064         }
0065         @if $c == hover {
0066                 @return $SelectionDecorationHover;
0067         }
0068         @if $c == text {
0069                 @return $SelectionForegroundNormal;
0070         }
0071         @if $c == backdrop {
0072                 @return transparentize($SelectionBackgroundNormal, 0.5);
0073         }
0074 }
0075 
0076 // View Color
0077 @function internal_v_color($c: normal) {
0078         @if $c == normal {
0079                 @return $ViewBackgroundNormal;
0080         }
0081         @if $c == hover {
0082                 @return $ViewDecorationHover;
0083         }
0084         @if $c == active {
0085                 @return $ViewDecorationFocus;
0086         }
0087         @if $c == text {
0088                 @return $ViewForegroundNormal;
0089         }
0090 }
0091 
0092 // Window Color
0093 @function internal_w_color($c: normal) {
0094         @if $c == normal {
0095                 @return $WindowBackgroundNormal;
0096         }
0097         @if $c == text {
0098                 @return $WindowForegroundNormal;
0099         }
0100 }
0101 
0102 // Titlebar color
0103 @function internal_t_color($c: text) {
0104         @if $c == text {
0105                 @return $WMactiveForeground;
0106         }
0107         @if $c == background {
0108                 @return $WMactiveBackground;
0109         }
0110         @if $c == background-light {
0111                 @return $WindowBackgroundNormal;
0112         }
0113         @if $c == backdrop-text {
0114                 @return $WMinactiveForeground;
0115         }
0116         @if $c == backdrop-background {
0117                 @return $WMinactiveBackground;
0118         }
0119 }
0120 
0121 @function internal_tooltip($c: text) {
0122         @if $c == text {
0123                 @return $TooltipForegroundNormal;
0124         }
0125         @if $c == background {
0126                 @return $TooltipBackgroundNormal;
0127         }
0128         @if $c == border {
0129                 @return mix(
0130                         $TooltipForegroundNormal,
0131                         $TooltipBackgroundNormal,
0132                         25%
0133                 );
0134         }
0135 }
0136 
0137 @function internal_button_gradient($c, $state: normal) {
0138         @if $state == normal {
0139                 @return linear-gradient(
0140                         to bottom,
0141                         change-color(
0142                                 $c,
0143                                 $lightness: min(lightness($c) * 1.01, 100%)
0144                         ),
0145                         change-color(
0146                                 $c,
0147                                 $lightness: min(lightness($c) / 1.03, 100%)
0148                         )
0149                 );
0150         } @else {
0151                 @return linear-gradient(
0152                         to bottom,
0153                         change-color(
0154                                 $c,
0155                                 $lightness: min(lightness($c) * 1.03, 100%)
0156                         ),
0157                         change-color(
0158                                 $c,
0159                                 $lightness: min(lightness($c) / 1.1, 100%)
0160                         )
0161                 );
0162         }
0163 }
0164 
0165 $border_color: mix(
0166         $WindowBackgroundNormal,
0167         $WindowForegroundNormal,
0168         75%
0169 );
0170 $ligh_border_color: gtkmix(
0171         $WindowBackgroundNormal,
0172         $WindowForegroundNormal,
0173         0.07
0174 );
0175 
0176 $menu_color: internal_w_color(normal);
0177 $link_color: $ViewForegroundLink;
0178 $link_visited_color: $ViewForegroundVisited;
0179 
0180 $warning_color: $ViewForegroundNeutral;
0181 $error_color: $ViewForegroundNegative;
0182 $success_color: $ViewForegroundPositive;
0183 $destructive_color: $error_color;
0184 
0185 $arrow_down: "go-down-symbolic";
0186 $arrow_left: "go-previous-symbolic";
0187 $arrow_right: "go-next-symbolic";
0188 $arrow_up: "go-up-symbolic";
0189 
0190 $trough_color: gtkmix(
0191         gtk("@theme_bg_color"),
0192         gtk("@theme_fg_color"),
0193         0.7
0194 );
0195 $trough_color_backdrop: gtkmix(
0196         gtk("@theme_unfocused_bg_color"),
0197         gtk("@theme_unfocused_fg_color"),
0198         0.7
0199 );
0200 $trough_color_insensitive: gtkmix(
0201         gtk("@insensitive_bg_color"),
0202         gtk("@insensitive_fg_color"),
0203         0.7
0204 );
0205 $trough_color_backdrop_insensitive: gtkmix(
0206         gtk("@insensitive_unfocused_bg_color"),
0207         gtk("@insensitive_unfocused_fg_color"),
0208         0.7
0209 );
0210 
0211 $scrollbar_color: gtkmix(
0212         $trough_color,
0213         gtk("@theme_text_color"),
0214         0.5
0215 );
0216 $scrollbar_color_backdrop: gtkmix(
0217         $trough_color_backdrop,
0218         gtk("@theme_unfocused_text_color"),
0219         0.5
0220 );
0221 
0222 //
0223 // Color effects
0224 //
0225 //
0226 // Color maps for color effect functions
0227 //
0228 $Color: (
0229         Disabled: $DisabledColor,
0230         Inactive: $InactiveColor,
0231 );
0232 $ColorAmount: (
0233         Disabled: $DisabledColorAmount,
0234         Inactive: $InactiveColorAmount,
0235 );
0236 $ColorEffect: (
0237         Disabled: $DisabledColorEffect,
0238         Inactive: $InactiveColorEffect,
0239 );
0240 $ContrastAmount: (
0241         Disabled: $DisabledContrastAmount,
0242         Inactive: $InactiveContrastAmount,
0243 );
0244 $ContrastEffect: (
0245         Disabled: $DisabledContrastEffect,
0246         Inactive: $InactiveContrastEffect,
0247 );
0248 $IntensityAmount: (
0249         Disabled: $DisabledIntensityAmount,
0250         Inactive: $InactiveIntensityAmount,
0251 );
0252 $IntensityEffect: (
0253         Disabled: $DisabledIntensityEffect,
0254         Inactive: $InactiveIntensityEffect,
0255 );
0256 
0257 $r: 0.75mm; // standard radius
0258 
0259 @function internal_insensitive($c) {
0260         @return internal_Color(
0261                 internal_Intensity(
0262                         internal_Contrast($c, Disabled),
0263                         Disabled
0264                 ),
0265                 Disabled
0266         );
0267 }
0268 
0269 @function internal_backdrop($c) {
0270         @if $InactiveEnable == true {
0271                 @return internal_Color(
0272                         internal_Intensity(
0273                                 internal_Contrast($c, Inactive),
0274                                 Inactive
0275                         ),
0276                         Inactive
0277                 );
0278         } @else {
0279                 @return $c;
0280         }
0281 }
0282 
0283 @function internal_Contrast($c, $state) {
0284         @if map-get($ContrastEffect, $state) == 0 {
0285                 @return $c;
0286         }
0287 
0288         @if map-get($ContrastEffect, $state) == 1 {
0289                 @if lightness(internal_w_color()) >
0290                         lightness(internal_w_color(text))
0291                 {
0292                         @if lightness($c) <
0293                                 lightness(internal_w_color()) or
0294                                 (
0295                                         $c ==
0296                                                 internal_t_color(text) and
0297                                                 lightness(internal_t_color(background)) <=
0298                                                 lightness(internal_t_color(text))
0299                                 )
0300                         {
0301                                 @return transparentize(
0302                                         $c,
0303                                         map-get($ContrastAmount, $state)
0304                                 );
0305                         } @else {
0306                                 @return $c;
0307                         }
0308                 }
0309                 @if lightness(internal_w_color()) <=
0310                         lightness(internal_w_color(text))
0311                 {
0312                         @if lightness($c) >
0313                                 lightness(internal_w_color()) or
0314                                 (
0315                                         $c ==
0316                                                 internal_t_color(text) and
0317                                                 lightness(internal_t_color(background)) >
0318                                                 lightness(internal_t_color(text))
0319                                 )
0320                         {
0321                                 @return transparentize(
0322                                         $c,
0323                                         map-get($ContrastAmount, $state)
0324                                 );
0325                         } @else {
0326                                 @return $c;
0327                         }
0328                 }
0329         }
0330 
0331         @if map-get($ContrastEffect, $state) == 2 {
0332                 @if lightness(internal_w_color()) >
0333                         lightness(internal_w_color(text))
0334                 {
0335                         // don't know what a reasonable lightness treshhold is for Contrast
0336                         @if lightness($c) <
0337                                 lightness(internal_w_color()) or
0338                                 (
0339                                         $c ==
0340                                                 internal_t_color(text) and
0341                                                 lightness(internal_t_color(background)) <=
0342                                                 lightness(internal_t_color(text))
0343                                 )
0344                         {
0345                                 @return transparentize(
0346                                         $c,
0347                                         map-get($ContrastAmount, $state)
0348                                 );
0349                         } @else {
0350                                 @return $c;
0351                         }
0352                 }
0353                 @if lightness(internal_w_color()) <=
0354                         lightness(internal_w_color(text))
0355                 {
0356                         @if lightness($c) >
0357                                 lightness(internal_w_color()) or
0358                                 (
0359                                         $c ==
0360                                                 internal_t_color(text) and
0361                                                 lightness(internal_t_color(background)) >
0362                                                 lightness(internal_t_color(text))
0363                                 )
0364                         {
0365                                 @return transparentize(
0366                                         $c,
0367                                         map-get($ContrastAmount, $state)
0368                                 );
0369                         } @else {
0370                                 @return $c;
0371                         }
0372                 }
0373         }
0374 }
0375 
0376 @function internal_Color($c, $state) {
0377         @if map-get($ColorEffect, $state) ==0 {
0378                 @return $c;
0379         }
0380 
0381         @if map-get($ColorEffect, $state) ==1 {
0382                 @if map-get($ColorAmount, $state) >=0 {
0383                         @return desaturate(
0384                                 $c,
0385                                 percentage(map-get($ColorAmount, $state))
0386                         );
0387                 } @else {
0388                         @return saturate(
0389                                 $c,
0390                                 percentage(abs(map-get($ColorAmount, $state)))
0391                         );
0392                 }
0393         }
0394 
0395         @if map-get($ColorEffect, $state)
0396                 ==2 or
0397                 map-get($ColorEffect, $state)
0398                 ==3
0399         {
0400                 // 2 and 3 seem to do the same
0401                 @return mix(
0402                         map-get($Color, $state),
0403                         $c,
0404                         percentage(map-get($ColorAmount, $state))
0405                 );
0406         }
0407 }
0408 
0409 @function internal_Intensity($c, $state) {
0410         @if map-get($IntensityEffect, $state) == 0 {
0411                 @return $c;
0412         }
0413         @if map-get($IntensityEffect, $state) == 1 {
0414                 @if map-get($IntensityAmount, $state) >= 0 {
0415                         @return mix(
0416                                 white,
0417                                 $c,
0418                                 percentage(map-get($IntensityAmount, $state))
0419                         );
0420                 } @else {
0421                         @return mix(
0422                                 black,
0423                                 $c,
0424                                 percentage(abs(map-get($IntensityAmount, $state)))
0425                         );
0426                 }
0427         }
0428 
0429         @if map-get($IntensityEffect, $state) == 2 {
0430                 @if map-get($IntensityAmount, $state) == -1 {
0431                         @return change-color($c, $lightness: 100%);
0432                 } @else {
0433                         @return change-color(
0434                                 $c,
0435                                 $lightness:
0436                                         min(
0437                                                 lightness($c) /
0438                                                         (1 + map-get($IntensityAmount, $state)),
0439                                                 100%
0440                                         )
0441                         );
0442                 }
0443         }
0444 
0445         @if map-get($IntensityEffect, $state) == 3 {
0446                 @return change-color(
0447                         $c,
0448                         $lightness:
0449                                 min(
0450                                         lightness($c) *
0451                                                 (1 + map-get($IntensityAmount, $state)),
0452                                         100%
0453                                 )
0454                 );
0455         }
0456 }
0457 
0458 @function internal_alpha2solid($c, $background) {
0459         $amount: alpha($c);
0460         $c: rgb(red($c), green($c), blue($c));
0461         @return mix($c, $background, $amount);
0462 }