-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Interaction state hover for checkbox (#2122)
* π Add function that calculates hover color * π Apply transition * β»οΈ π Move helper function to shared location #2128 also needs to calculate color in the exact same way
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
@forward 'focus'; | ||
@forward 'hover'; | ||
@forward 'layer' hide apply-state; | ||
@forward 'utilities'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@use 'sass:color'; | ||
@use 'layer'; | ||
@use '../utils'; | ||
|
||
@function get-state-color($variant, $loudness: layer.$default-loudness, $flip: false) { | ||
$_background: utils.get-color($variant, $getValueOnly: true); | ||
|
||
$_lightness: 0% !default; | ||
|
||
@if $flip { | ||
$_lightness: utils.get-loudness($loudness); | ||
} @else { | ||
// negative number means "make it darker" | ||
$_lightness: -1 * utils.get-loudness($loudness); | ||
} | ||
|
||
$hover-color: #{color.scale($_background, $lightness: $_lightness)}; | ||
|
||
@return $hover-color; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters