Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styles: add switch #708

Draft
wants to merge 1 commit into
base: danirabbit/demo-styles
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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