Skip to content

Instantly share code, notes, and snippets.

@muhammadawaisshaikh
Created June 21, 2020 03:27
Show Gist options
  • Save muhammadawaisshaikh/4dc59cde09acfdc0852726a15c16d408 to your computer and use it in GitHub Desktop.
Save muhammadawaisshaikh/4dc59cde09acfdc0852726a15c16d408 to your computer and use it in GitHub Desktop.
change items color dynamically using scss loops
$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