Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Breeze for GTK
Commits
c950952f
Commit
c950952f
authored
Nov 18, 2021
by
Jan Blackquill
🌈
Committed by
Nate Graham
Nov 22, 2021
Browse files
gtk3, gtk4: format with prettier
(cherry picked from commit
c18f2a47
)
parent
1b3a52dc
Changes
66
Expand all
Hide whitespace changes
Inline
Side-by-side
.prettierrc
0 → 100644
View file @
c950952f
useTabs: true
printWidth: 60
src/_functions.scss
View file @
c950952f
...
...
@@ -4,22 +4,22 @@
// escape string entirely
@function
gtk
(
$str
)
{
@return
unquote
(
"
#{
$str
}
_breeze"
);
@return
unquote
(
"
#{
$str
}
_breeze"
);
}
// alpha function
@function
gtkalpha
(
$c
,
$a
)
{
@return
unquote
(
"alpha(
#{
$c
}
,
#{
$a
}
)"
);
@return
unquote
(
"alpha(
#{
$c
}
,
#{
$a
}
)"
);
}
// shade function
@function
gtkshade
(
$c
,
$a
)
{
@return
unquote
(
"shade(
#{
$c
}
_breeze,
#{
$a
}
)"
);
@return
unquote
(
"shade(
#{
$c
}
_breeze,
#{
$a
}
)"
);
}
// mix function
@function
gtkmix
(
$c1
,
$c2
,
$m
)
{
@return
unquote
(
"mix(
#{
$c1
}
,
#{
$c2
}
,
#{
$m
}
)"
);
@return
unquote
(
"mix(
#{
$c1
}
,
#{
$c2
}
,
#{
$m
}
)"
);
}
//
...
...
@@ -28,113 +28,133 @@
// Button Color
@function
internal_b_color
(
$c
:
normal
)
{
@if
$c
==
normal
{
@return
$ButtonBackgroundNormal
;
}
@if
$c
==
hover
{
@return
$ButtonDecorationHover
;
}
@if
$c
==
active
{
@return
$ButtonDecorationFocus
;
}
@if
$c
==
text
{
@return
$ButtonForegroundNormal
;
}
@if
$c
==
active-text
{
@return
$SelectionForegroundNormal
;
}
@if
$c
==
normal
{
@return
$ButtonBackgroundNormal
;
}
@if
$c
==
hover
{
@return
$ButtonDecorationHover
;
}
@if
$c
==
active
{
@return
$ButtonDecorationFocus
;
}
@if
$c
==
text
{
@return
$ButtonForegroundNormal
;
}
@if
$c
==
active-text
{
@return
$SelectionForegroundNormal
;
}
}
// Selection Color
@function
internal_s_color
(
$c
:
normal
)
{
@if
$c
==
normal
{
@return
$SelectionBackgroundNormal
;
}
@if
$c
==
hover
{
@return
$SelectionDecorationHover
;
}
@if
$c
==
text
{
@return
$SelectionForegroundNormal
;
}
@if
$c
==
backdrop
{
@return
transparentize
(
$SelectionBackgroundNormal
,
0
.5
);
}
@if
$c
==
normal
{
@return
$SelectionBackgroundNormal
;
}
@if
$c
==
hover
{
@return
$SelectionDecorationHover
;
}
@if
$c
==
text
{
@return
$SelectionForegroundNormal
;
}
@if
$c
==
backdrop
{
@return
transparentize
(
$SelectionBackgroundNormal
,
0
.5
);
}
}
// View Color
@function
internal_v_color
(
$c
:
normal
)
{
@if
$c
==
normal
{
@return
$ViewBackgroundNormal
;
}
@if
$c
==
hover
{
@return
$ViewDecorationHover
;
}
@if
$c
==
active
{
@return
$ViewDecorationFocus
;
}
@if
$c
==
text
{
@return
$ViewForegroundNormal
;
}
@if
$c
==
normal
{
@return
$ViewBackgroundNormal
;
}
@if
$c
==
hover
{
@return
$ViewDecorationHover
;
}
@if
$c
==
active
{
@return
$ViewDecorationFocus
;
}
@if
$c
==
text
{
@return
$ViewForegroundNormal
;
}
}
// Window Color
@function
internal_w_color
(
$c
:
normal
)
{
@if
$c
==
normal
{
@return
$WindowBackgroundNormal
;
}
@if
$c
==
text
{
@return
$WindowForegroundNormal
;
}
@if
$c
==
normal
{
@return
$WindowBackgroundNormal
;
}
@if
$c
==
text
{
@return
$WindowForegroundNormal
;
}
}
// Titlebar color
@function
internal_t_color
(
$c
:
text
)
{
@if
$c
==
text
{
@return
$WMactiveForeground
;
}
@if
$c
==
background
{
@return
$WMactiveBackground
;
}
@if
$c
==
background-light
{
@return
$WindowBackgroundNormal
;
}
@if
$c
==
backdrop-text
{
@return
$WMinactiveForeground
;
}
@if
$c
==
backdrop-background
{
@return
$WMinactiveBackground
;
}
@if
$c
==
text
{
@return
$WMactiveForeground
;
}
@if
$c
==
background
{
@return
$WMactiveBackground
;
}
@if
$c
==
background-light
{
@return
$WindowBackgroundNormal
;
}
@if
$c
==
backdrop-text
{
@return
$WMinactiveForeground
;
}
@if
$c
==
backdrop-background
{
@return
$WMinactiveBackground
;
}
}
@function
internal_tooltip
(
$c
:
text
)
{
@if
$c
==
text
{
@return
$TooltipForegroundNormal
;
}
@if
$c
==
background
{
@return
$TooltipBackgroundNormal
;
}
@if
$c
==
border
{
@return
mix
(
$TooltipForegroundNormal
,
$TooltipBackgroundNormal
,
25%
);
}
@if
$c
==
text
{
@return
$TooltipForegroundNormal
;
}
@if
$c
==
background
{
@return
$TooltipBackgroundNormal
;
}
@if
$c
==
border
{
@return
mix
(
$TooltipForegroundNormal
,
$TooltipBackgroundNormal
,
25%
);
}
}
@function
internal_button_gradient
(
$c
,
$state
:
normal
)
{
@if
$state
==
normal
{
@return
linear-gradient
(
to
bottom
,
change-color
(
$c
,
$lightness
:
min
(
lightness
(
$c
)
*
1
.01
,
100%
))
,
change-color
(
$c
,
$lightness
:
min
(
lightness
(
$c
)
/
1
.03
,
100%
))
);
}
@else
{
@return
linear-gradient
(
to
bottom
,
change-color
(
$c
,
$lightness
:
min
(
lightness
(
$c
)
*
1
.03
,
100%
))
,
change-color
(
$c
,
$lightness
:
min
(
lightness
(
$c
)
/
1
.1
,
100%
))
);
}
@if
$state
==
normal
{
@return
linear-gradient
(
to
bottom
,
change-color
(
$c
,
$lightness
:
min
(
lightness
(
$c
)
*
1
.01
,
100%
)
)
,
change-color
(
$c
,
$lightness
:
min
(
lightness
(
$c
)
/
1
.03
,
100%
)
)
);
}
@else
{
@return
linear-gradient
(
to
bottom
,
change-color
(
$c
,
$lightness
:
min
(
lightness
(
$c
)
*
1
.03
,
100%
)
)
,
change-color
(
$c
,
$lightness
:
min
(
lightness
(
$c
)
/
1
.1
,
100%
)
)
);
}
}
$border_color
:
mix
(
$WindowBackgroundNormal
,
$WindowForegroundNormal
,
75%
);
$border_color
:
mix
(
$WindowBackgroundNormal
,
$WindowForegroundNormal
,
75%
);
$menu_color
:
internal_w_color
(
normal
);
$link_color
:
$ViewForegroundLink
;
$link_visited_color
:
$ViewForegroundVisited
;
...
...
@@ -144,33 +164,41 @@ $error_color: $ViewForegroundNegative;
$success_color
:
$ViewForegroundPositive
;
$destructive_color
:
$error_color
;
$arrow_down
:
'
go-down-symbolic
'
;
$arrow_left
:
'
go-previous-symbolic
'
;
$arrow_right
:
'
go-next-symbolic
'
;
$arrow_up
:
'
go-up-symbolic
'
;
$arrow_down
:
"
go-down-symbolic
"
;
$arrow_left
:
"
go-previous-symbolic
"
;
$arrow_right
:
"
go-next-symbolic
"
;
$arrow_up
:
"
go-up-symbolic
"
;
$trough_color
:
gtkmix
(
gtk
(
"@theme_bg_color"
)
,
gtk
(
"@theme_fg_color"
)
,
0
.7
);
$trough_color
:
gtkmix
(
gtk
(
"@theme_bg_color"
)
,
gtk
(
"@theme_fg_color"
)
,
0
.7
);
$trough_color_backdrop
:
gtkmix
(
gtk
(
"@theme_unfocused_bg_color"
)
,
gtk
(
"@theme_unfocused_fg_color"
)
,
0
.7
gtk
(
"@theme_unfocused_bg_color"
)
,
gtk
(
"@theme_unfocused_fg_color"
)
,
0
.7
);
$trough_color_insensitive
:
gtkmix
(
gtk
(
"@insensitive_bg_color"
)
,
gtk
(
"@insensitive_fg_color"
)
,
0
.7
gtk
(
"@insensitive_bg_color"
)
,
gtk
(
"@insensitive_fg_color"
)
,
0
.7
);
$trough_color_backdrop_insensitive
:
gtkmix
(
gtk
(
"@insensitive_unfocused_bg_color"
)
,
gtk
(
"@insensitive_unfocused_fg_color"
)
,
0
.7
gtk
(
"@insensitive_unfocused_bg_color"
)
,
gtk
(
"@insensitive_unfocused_fg_color"
)
,
0
.7
);
$scrollbar_color
:
gtkmix
(
$trough_color
,
gtk
(
"@theme_text_color"
)
,
0
.5
);
$scrollbar_color
:
gtkmix
(
$trough_color
,
gtk
(
"@theme_text_color"
)
,
0
.5
);
$scrollbar_color_backdrop
:
gtkmix
(
$trough_color_backdrop
,
gtk
(
"@theme_unfocused_text_color"
)
,
0
.5
$trough_color_backdrop
,
gtk
(
"@theme_unfocused_text_color"
)
,
0
.5
);
//
...
...
@@ -180,189 +208,237 @@ $scrollbar_color_backdrop: gtkmix(
// Color maps for color effect functions
//
$Color
:
(
Disabled
:
$DisabledColor
,
Inactive
:
$InactiveColor
,
Disabled
:
$DisabledColor
,
Inactive
:
$InactiveColor
,
);
$ColorAmount
:
(
Disabled
:
$DisabledColorAmount
,
Inactive
:
$InactiveColorAmount
,
Disabled
:
$DisabledColorAmount
,
Inactive
:
$InactiveColorAmount
,
);
$ColorEffect
:
(
Disabled
:
$DisabledColorEffect
,
Inactive
:
$InactiveColorEffect
,
Disabled
:
$DisabledColorEffect
,
Inactive
:
$InactiveColorEffect
,
);
$ContrastAmount
:
(
Disabled
:
$DisabledContrastAmount
,
Inactive
:
$InactiveContrastAmount
,
Disabled
:
$DisabledContrastAmount
,
Inactive
:
$InactiveContrastAmount
,
);
$ContrastEffect
:
(
Disabled
:
$DisabledContrastEffect
,
Inactive
:
$InactiveContrastEffect
,
Disabled
:
$DisabledContrastEffect
,
Inactive
:
$InactiveContrastEffect
,
);
$IntensityAmount
:
(
Disabled
:
$DisabledIntensityAmount
,
Inactive
:
$InactiveIntensityAmount
,
Disabled
:
$DisabledIntensityAmount
,
Inactive
:
$InactiveIntensityAmount
,
);
$IntensityEffect
:
(
Disabled
:
$DisabledIntensityEffect
,
Inactive
:
$InactiveIntensityEffect
,
Disabled
:
$DisabledIntensityEffect
,
Inactive
:
$InactiveIntensityEffect
,
);
$r
:
3px
;
// standard radius
@function
internal_insensitive
(
$c
)
{
@return
internal_Color
(
internal_Intensity
(
internal_Contrast
(
$c
,
Disabled
)
,
Disabled
)
,
Disabled
);
@return
internal_Color
(
internal_Intensity
(
internal_Contrast
(
$c
,
Disabled
)
,
Disabled
)
,
Disabled
);
}
@function
internal_backdrop
(
$c
)
{
@if
$InactiveEnable
==
true
{
@return
internal_Color
(
internal_Intensity
(
internal_Contrast
(
$c
,
Inactive
)
,
Inactive
)
,
Inactive
);
}
@else
{
@return
$c
;
}
@if
$InactiveEnable
==
true
{
@return
internal_Color
(
internal_Intensity
(
internal_Contrast
(
$c
,
Inactive
)
,
Inactive
)
,
Inactive
);
}
@else
{
@return
$c
;
}
}
@function
internal_Contrast
(
$c
,
$state
)
{
@if
map-get
(
$ContrastEffect
,
$state
)
==
0
{
@return
$c
;
}
@if
map-get
(
$ContrastEffect
,
$state
)
==
1
{
@if
lightness
(
internal_w_color
())
>
lightness
(
internal_w_color
(
text
))
{
@if
lightness
(
$c
)
<
lightness
(
internal_w_color
())
or
(
$c
==
internal_t_color
(
text
)
and
lightness
(
internal_t_color
(
background
))
<=
lightness
(
internal_t_color
(
text
))
)
{
@return
transparentize
(
$c
,
map-get
(
$ContrastAmount
,
$state
));
}
@else
{
@return
$c
;
}
}
@if
lightness
(
internal_w_color
())
<=
lightness
(
internal_w_color
(
text
))
{
@if
lightness
(
$c
)
>
lightness
(
internal_w_color
())
or
(
$c
==
internal_t_color
(
text
)
and
lightness
(
internal_t_color
(
background
))
>
lightness
(
internal_t_color
(
text
))
)
{
@return
transparentize
(
$c
,
map-get
(
$ContrastAmount
,
$state
));
}
@else
{
@return
$c
;
}
}
}
@if
map-get
(
$ContrastEffect
,
$state
)
==
2
{
@if
lightness
(
internal_w_color
())
>
lightness
(
internal_w_color
(
text
))
{
// don't know what a reasonable lightness treshhold is for Contrast
@if
lightness
(
$c
)
<
lightness
(
internal_w_color
())
or
(
$c
==
internal_t_color
(
text
)
and
lightness
(
internal_t_color
(
background
))
<=
lightness
(
internal_t_color
(
text
))
)
{
@return
transparentize
(
$c
,
map-get
(
$ContrastAmount
,
$state
));
}
@else
{
@return
$c
;
}
}
@if
lightness
(
internal_w_color
())
<=
lightness
(
internal_w_color
(
text
))
{
@if
lightness
(
$c
)
>
lightness
(
internal_w_color
())
or
(
$c
==
internal_t_color
(
text
)
and
lightness
(
internal_t_color
(
background
))
>
lightness
(
internal_t_color
(
text
))
)
{
@return
transparentize
(
$c
,
map-get
(
$ContrastAmount
,
$state
));
}
@else
{
@return
$c
;
}
}
}
@if
map-get
(
$ContrastEffect
,
$state
)
==
0
{
@return
$c
;
}
@if
map-get
(
$ContrastEffect
,
$state
)
==
1
{
@if
lightness
(
internal_w_color
())
>
lightness
(
internal_w_color
(
text
))
{
@if
lightness
(
$c
)
<
lightness
(
internal_w_color
())
or
(
$c
==
internal_t_color
(
text
)
and
lightness
(
internal_t_color
(
background
))
<=
lightness
(
internal_t_color
(
text
))
)
{
@return
transparentize
(
$c
,
map-get
(
$ContrastAmount
,
$state
)
);
}
@else
{
@return
$c
;
}
}
@if
lightness
(
internal_w_color
())
<=
lightness
(
internal_w_color
(
text
))
{
@if
lightness
(
$c
)
>
lightness
(
internal_w_color
())
or
(
$c
==
internal_t_color
(
text
)
and
lightness
(
internal_t_color
(
background
))
>
lightness
(
internal_t_color
(
text
))
)
{
@return
transparentize
(
$c
,
map-get
(
$ContrastAmount
,
$state
)
);
}
@else
{
@return
$c
;
}
}
}
@if
map-get
(
$ContrastEffect
,
$state
)
==
2
{
@if
lightness
(
internal_w_color
())
>
lightness
(
internal_w_color
(
text
))
{
// don't know what a reasonable lightness treshhold is for Contrast
@if
lightness
(
$c
)
<
lightness
(
internal_w_color
())
or
(
$c
==
internal_t_color
(
text
)
and
lightness
(
internal_t_color
(
background
))
<=
lightness
(
internal_t_color
(
text
))
)
{
@return
transparentize
(
$c
,
map-get
(
$ContrastAmount
,
$state
)
);
}
@else
{
@return
$c
;
}
}
@if
lightness
(
internal_w_color
())
<=
lightness
(
internal_w_color
(
text
))
{
@if
lightness
(
$c
)
>
lightness
(
internal_w_color
())
or
(
$c
==
internal_t_color
(
text
)
and
lightness
(
internal_t_color
(
background
))
>
lightness
(
internal_t_color
(
text
))
)
{
@return
transparentize
(
$c
,
map-get
(
$ContrastAmount
,
$state
)
);
}
@else
{
@return
$c
;
}
}
}
}
@function
internal_Color
(
$c
,
$state
)
{
@if
map-get
(
$ColorEffect
,
$state
)
==
0
{
@return
$c
;
}
@if
map-get
(
$ColorEffect
,
$state
)
==
1
{
@if
map-get
(
$ColorAmount
,
$state
)
>=
0
{
@return
desaturate
(
$c
,
percentage
(
map-get
(
$ColorAmount
,
$state
)));
}
@else
{
@return
saturate
(
$c
,
percentage
(
abs
(
map-get
(
$ColorAmount
,
$state
))));
}
}
@if
map-get
(
$ColorEffect
,
$state
)
==
2
or
map-get
(
$ColorEffect
,
$state
)
==
3
{
// 2 and 3 seem to do the same
@return
mix
(
map-get
(
$Color
,
$state
)
,
$c
,
percentage
(
map-get
(
$ColorAmount
,
$state
))
);
}
@if
map-get
(
$ColorEffect
,
$state
)
==
0
{
@return
$c
;
}
@if
map-get
(
$ColorEffect
,
$state
)
==
1
{
@if
map-get
(
$ColorAmount
,
$state
)
>=
0
{
@return
desaturate
(
$c
,
percentage
(
map-get
(
$ColorAmount
,
$state
))
);
}
@else
{
@return
saturate
(
$c
,
percentage
(
abs
(
map-get
(
$ColorAmount
,
$state
)))
);
}
}
@if
map-get
(
$ColorEffect
,
$state
)
==
2
or
map-get
(
$ColorEffect
,
$state
)
==
3
{
// 2 and 3 seem to do the same
@return
mix
(
map-get
(
$Color
,
$state
)
,
$c
,
percentage
(
map-get
(
$ColorAmount
,
$state
))
);
}
}
@function
internal_Intensity
(
$c
,
$state
)
{
@if
map-get
(
$IntensityEffect
,
$state
)
==
0
{
@return
$c
;
}
@if
map-get
(
$IntensityEffect
,
$state
)
==
1
{
@if
map-get
(
$IntensityAmount
,
$state
)
>=
0
{
@return
mix
(
white
,
$c
,
percentage
(
map-get
(
$IntensityAmount
,
$state
)));
}
@else
{
@return
mix
(
black
,
$c
,
percentage
(
abs
(
map-get
(
$IntensityAmount
,
$state
)))
);
}