[libadwaita/wip/exalm/exclusive-toggles: 1/2] stylesheet: Add .exclusive style
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/wip/exalm/exclusive-toggles: 1/2] stylesheet: Add .exclusive style
- Date: Sat, 11 Sep 2021 16:54:19 +0000 (UTC)
commit 637a991370f4d65fb3d3ef0ec6c90fa50cfd6ec0
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sat Sep 11 18:46:57 2021 +0500
stylesheet: Add .exclusive style
Adjust stack switcher to use it as well, even though it's .linked
internally.
Fixes https://gitlab.gnome.org/GNOME/libadwaita/-/issues/212
src/stylesheet/_widgets.scss | 1 +
src/stylesheet/meson.build | 1 +
src/stylesheet/widgets/_exclusive-toggles.scss | 96 ++++++++++++++++++++++++++
src/stylesheet/widgets/_toolbars.scss | 13 +++-
4 files changed, 110 insertions(+), 1 deletion(-)
---
diff --git a/src/stylesheet/_widgets.scss b/src/stylesheet/_widgets.scss
index fbf00430..ea3ec960 100644
--- a/src/stylesheet/_widgets.scss
+++ b/src/stylesheet/_widgets.scss
@@ -7,6 +7,7 @@
@import 'widgets/dropdowns';
@import 'widgets/emoji-chooser';
@import 'widgets/entries';
+@import 'widgets/exclusive-toggles';
@import 'widgets/expanders';
@import 'widgets/file-chooser';
@import 'widgets/header-bar';
diff --git a/src/stylesheet/meson.build b/src/stylesheet/meson.build
index 4dbbfa9b..95919eff 100644
--- a/src/stylesheet/meson.build
+++ b/src/stylesheet/meson.build
@@ -31,6 +31,7 @@ if not fs.exists('Adwaita-light.css')
'widgets/_dropdowns.scss',
'widgets/_emoji-chooser.scss',
'widgets/_entries.scss',
+ 'widgets/_exclusive-toggles.scss',
'widgets/_expanders.scss',
'widgets/_file-chooser.scss',
'widgets/_header-bar.scss',
diff --git a/src/stylesheet/widgets/_exclusive-toggles.scss b/src/stylesheet/widgets/_exclusive-toggles.scss
new file mode 100644
index 00000000..02db03a6
--- /dev/null
+++ b/src/stylesheet/widgets/_exclusive-toggles.scss
@@ -0,0 +1,96 @@
+.exclusive {
+ background: gtkalpha(currentColor, .1);
+ padding: 3px;
+ border-radius: $button_radius + 3px;
+ border-spacing: 4px;
+
+ @if $contrast == 'high' {
+ box-shadow: inset 0 0 0 1px $borders_color;
+ }
+
+ > button {
+ @extend %undecorated_button;
+ box-shadow: none;
+
+ @include focus-ring($offset: 0px);
+ transition: $button_transition;
+
+ padding: 2px 8px;
+ font-weight: normal;
+
+ &.image-button {
+ padding-left: 3px;
+ padding-right: 3px;
+ }
+
+ &.text-button {
+ padding-left: 15px;
+ padding-right: 15px;
+ }
+
+ &.text-button.image-button,
+ &.image-text-button,
+ &.arrow-button {
+ padding-left: 7px;
+ padding-right: 7px;
+ }
+
+ &:hover {
+ background-color: gtkalpha(currentColor, .075);
+ }
+
+ &.keyboard-activating,
+ &:active {
+ background-color: gtkalpha(currentColor, .15);
+ }
+
+ @if $contrast == 'high' {
+ &:hover,
+ &:active,
+ &.keyboard-activating {
+ box-shadow: inset 0 0 0 1px $borders_color;
+ }
+ }
+
+ &:checked {
+ &, &:hover, &:active, &.keyboard-activating {
+ background-color: $slider_color; /*alpha(white, .2);*/
+ color: $light_fg;
+ box-shadow: 0 2px 4px transparentize(black, .8);
+
+ @if $contrast == 'high' {
+ box-shadow: 0 0 0 1px transparentize(black, .5),
+ 0 2px 4px transparentize(black, .8);
+ }
+ }
+ }
+ }
+}
+
+// stack switchers are linked, but we're making them look as if they weren't.
+// This involves some ugly specificity bumps.
+stackswitcher.linked {
+ @extend .exclusive;
+
+ &:not(.vertical) > button {
+ &:dir(ltr), &:dir(rtl) {
+ &:not(:first-child),
+ &:not(:last-child) {
+ border-radius: $button_radius;
+ margin-top: 0;
+ margin-bottom: 0;
+ }
+ }
+ }
+
+ &.vertical {
+ &:dir(ltr), &:dir(rtl) {
+ &:not(:first-child),
+ &:not(:last-child) {
+ border-radius: $button_radius;
+ margin-top: 0;
+ margin-bottom: 0;
+ }
+ }
+ }
+}
diff --git a/src/stylesheet/widgets/_toolbars.scss b/src/stylesheet/widgets/_toolbars.scss
index c47aaca0..3593ce26 100644
--- a/src/stylesheet/widgets/_toolbars.scss
+++ b/src/stylesheet/widgets/_toolbars.scss
@@ -66,6 +66,16 @@
margin-bottom: 10px;
}
+ .exclusive {
+ margin-top: 6px;
+ margin-bottom: 6px;
+
+ > button {
+ margin-top: 0;
+ margin-bottom: 0;
+ }
+ }
+
// Reset styles for popovers
popover {
button:not(.raised):not(.suggested-action):not(.destructive-action) {
@@ -88,7 +98,8 @@
separator:not(.sidebar),
button,
menubutton,
- switch {
+ switch,
+ .exclusive {
margin-top: 0;
margin-bottom: 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]