Created
June 21, 2020 03:27
-
-
Save muhammadawaisshaikh/4dc59cde09acfdc0852726a15c16d408 to your computer and use it in GitHub Desktop.
change items color dynamically using scss loops
This file contains hidden or 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
$base-color: rgb(239, 109, 172); | |
$gradiated-buttons-count: 10; | |
$strength: 5; | |
$degrees: 20deg; | |
.sidebar { | |
@for $i from 0 to $gradiated-buttons-count { | |
ul { | |
li:nth-child(#{$i}) { | |
img { | |
// exponential | |
background-color: darken($base-color, $i*$strength); | |
// degree based hue | |
background-color: adjust-hue($base-color, $degrees*$i) | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment