Skip to content

Commit

Permalink
Add separate colors for switch (from check)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlaki committed Aug 20, 2024
1 parent a7b5332 commit 88895f4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
10 changes: 9 additions & 1 deletion preview/assets/scss/config/_config.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ $spacer: 1.25rem;
'tertiary-foreground': hsl(0deg 0% 100%),
'tertiary-shadow-focus': color.adjust($color-tertiary, $alpha: -0.75),
),
form: (
'check-background': red,
'check-focus-ring': olive,
'check-foreground': aqua,
'switch-background': pink,
'switch-focus-ring': blue,
'switch-foreground': yellow,
),
),
$dark-colors: dark.$colors,
$form-select: (
Expand All @@ -48,7 +56,7 @@ $spacer: 1.25rem;
'icon-size': 1.25rem,
),
$form-fieldset: (
'layout-gap': 5rem,
'layout-gap': 1rem,
'legend-font-family': serif,
),
$form-label: (
Expand Down
3 changes: 3 additions & 0 deletions scss/config/_color.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ $colors: map.deep-merge(
'range-track-background': $color-gray-light,
'ring-focus': color.adjust($color-primary, $alpha: -0.75),
'select-foreground': $color-black,
'switch-background': $color-primary,
'switch-focus-ring': $color-primary,
'switch-foreground': $color-white,
'text': $color-gray,
'valid': $color-success,
'valid-focus-ring': color.adjust($color-success, $alpha: -0.75),
Expand Down
2 changes: 1 addition & 1 deletion scss/form/_check.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
&:focus-visible {
@include focus-ring(
$type: config('focus-ring-type', $form-check, false),
$border-color: color('border-focus', 'form'),
$border-color: color('check-background', 'form'),
$ring-color: color('check-focus-ring', 'form'),
$box-shadow-type: config('focus-ring-box-shadow-type', $form-check, false),
$ring-size: config('focus-ring-size', $form-check, false),
Expand Down
18 changes: 9 additions & 9 deletions scss/form/_switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,20 @@

&:focus-visible {
@include focus-ring(
$type: config('focus-ring-type', $form-check),
$border-color: color('border-focus', 'form'),
$ring-color: color('check-focus-ring', 'form'),
$box-shadow-type: config('focus-ring-box-shadow-type', $form-check),
$ring-size: config('focus-ring-size', $form-check),
$ring-offset: config('focus-ring-offset', $form-check)
$type: config('focus-ring-type', $form-check, false),
$border-color: color('switch-background', 'form'),
$ring-color: color('switch-focus-ring', 'form'),
$box-shadow-type: config('focus-ring-box-shadow-type', $form-check, false),
$ring-size: config('focus-ring-size', $form-check, false),
$ring-offset: config('focus-ring-offset', $form-check, false)
);
}

&:checked {
@include field-icon(config('switch', $form-icon, false), color('check-foreground', 'form', 'true'));
background-color: color('check-background', 'form');
@include field-icon(config('switch', $form-icon, false), color('switch-foreground', 'form', 'true'));
background-color: color('switch-background', 'form');
background-position: right center;
border-color: color('check-background', 'form');
border-color: color('switch-background', 'form');
}

&:disabled {
Expand Down

0 comments on commit 88895f4

Please sign in to comment.