-
-
Save muecas/ae9b45394e1425cc22c0cea4be8dcbbc to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
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
<div class="outcome"> | |
OUTCOME | |
</div> | |
<div class="outcome"> | |
OUTCOME | |
</div> | |
<div class="outcome"> | |
OUTCOME | |
</div> |
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
// ---- | |
// Sass (v3.5.6) | |
// Compass (vundefined) | |
// ---- | |
// Colors to use | |
$colors:( | |
red: red, | |
blue: blue | |
); | |
// Generated color lists | |
$generated: (); | |
// For each defined color | |
@each $name, $color in $colors { | |
// Current color map | |
$current : (); | |
// Generates the colors transformations (shades) | |
@for $i from 1 through 9 { | |
$current: append($current, lighten($color, (100 - ($i * 10)))); | |
} | |
// Adds the current color | |
$current: append($current, $color); | |
// Generates the colors transformations (tints) | |
@for $i from 11 through 19 { | |
$current: append($current, darken($color, ($i * 10) - 100)); | |
} | |
// If the map has not been created | |
@if map-has-key($generated, $name) == false { | |
$generated: map-merge($generated, ($color : $current)); | |
} | |
} | |
// Create a function to get the desired color | |
@function get-color($color, $index: 10) { // Default to base color | |
// Get the desired color map | |
$list: map-get($generated, $color); | |
// Return the color index | |
@return nth($list, $index); | |
} | |
.foo { | |
color: get-color(blue, 19); | |
} |
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
.foo { | |
color: black; | |
} |
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
<div class="outcome"> | |
OUTCOME | |
</div> | |
<div class="outcome"> | |
OUTCOME | |
</div> | |
<div class="outcome"> | |
OUTCOME | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment