Skip to content

Commit

Permalink
Styles: add switch
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Mar 22, 2024
1 parent 983619a commit b66aa35
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Styles/Granite/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ paper,
box-shadow:
highlight(),
// Intentionally not in ems since it's used as a stroke
0 0 0 1px $border-color,
0 0 0 1px scale-color($border-color, $alpha: -50%),
shadow(1);

&.rounded {
Expand Down
1 change: 1 addition & 0 deletions lib/Styles/Gtk/Index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@import 'Image.scss';
@import 'ShortcutsWindow.scss';
@import 'Spinner.scss';
@import 'Switch.scss';
@import 'Tooltip.scss';
@import 'WindowControls.scss';
@import 'Window.scss';
58 changes: 58 additions & 0 deletions lib/Styles/Gtk/Switch.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
switch {
background-color: scale-color($toplevel-border-color, $alpha: -50%); // FIXME: abstract as trough color?
border-radius: 99px;

&:checked:not(.mode-switch):not(:backdrop) {
background: $BLUEBERRY_500; // FIXME: accent color
}

&:disabled {
background-color: scale-color($toplevel-border-color, $alpha: -60%); // FIXME: abstract as trough color?
}

image {
color: transparent;
}

slider {
border-radius: 99px;
background-color: bg-color(0);
background-image:
linear-gradient(
to bottom,
scale-color($highlight_color, $alpha: -80%),
rgba(white, 0)
);
box-shadow:
highlight(),
0 0 0 1px $border-color,
shadow(2);

&:backdrop {
background-image: none;
box-shadow:
highlight(),
0 0 0 1px $border-color,
shadow(1);
}

&:disabled {
background-color: bg-color(3);
background-image: none;
box-shadow:
0 0 0 1px $border-color,
shadow(1);
}

:focus & {
box-shadow:
highlight(),
0 0 0 1px $BLUEBERRY_500, // FIXME: accent color
shadow(2);
outline-color: rgba($BLUEBERRY_500, 0.3); // FIXME: accent color
// Off-by-one to account for padding-box clip
outline-width: rem(3px);
outline-style: solid;
}
}
}
2 changes: 1 addition & 1 deletion lib/Styles/Index-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $toplevel-border-color: rgba(black, 0.75);
}

// Outset box shadow or border color on inputs like buttons, entries, checkboxes
$border-color: rgba(black, 0.1);
$border-color: rgba(black, 0.2);

// Text, images, and other foreground elements
$fg-color: white;
Expand Down
2 changes: 1 addition & 1 deletion lib/Styles/Index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $toplevel-border-color: rgba(black, 0.2);
}

// Outset box shadow or border color on inputs like buttons, entries, checkboxes
$border-color: rgba(black, 0.05);
$border-color: rgba(black, 0.1);

// Text, images, and other foreground elements
$fg-color: $BLACK_500;
Expand Down

0 comments on commit b66aa35

Please sign in to comment.