Last active
July 9, 2020 06:21
-
-
Save elijahmanor/29c80c3f76f7690425e2 to your computer and use it in GitHub Desktop.
Dynamic Repeating Sass Colors
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
$chartColors: #56c7fa, #f76540, #ffcb05, #62cd9f, #b67baa; | |
@for $i from 1 through length($chartColors) { | |
$chartColors: append($chartColors, darken(nth($chartColors, $i), 25)); | |
} |
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
$chartColors: #56c7fa, #f76540, #ffcb05, #62cd9f, #b67baa; | |
@for $i from 1 through length($chartColors) { | |
$chartColors: append($chartColors, darken(nth($chartColors, $i), 25)); | |
} | |
$chartColorsLength: length($chartColors); | |
.color { | |
@for $i from 1 through $chartColorsLength { | |
&:nth-of-type(#{$chartColorsLength}n+#{$i}) { | |
background-color: nth($chartColors, $i); | |
} | |
} | |
} |
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
.color:nth-of-type(10n+1) { | |
background-color: #56c7fa; | |
} | |
.color:nth-of-type(10n+2) { | |
background-color: #f76540; | |
} | |
.color:nth-of-type(10n+3) { | |
background-color: #ffcb05; | |
} | |
/* ... other 10n+# variations ... */ |
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
$chartColorsLength: length($chartColors); | |
.color { | |
@for $i from 1 through $chartColorsLength { | |
&:nth-of-type(#{$chartColorsLength}n+#{$i}) { | |
background-color: nth($chartColors, $i); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment