Last active
February 10, 2022 20:31
-
-
Save martindubenet/af73fca4dd514d8bd6838bab8c880f6b to your computer and use it in GitHub Desktop.
Testing Sass maps - Generated by SassMeister.com.
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
// Simple sass maps | |
$alphaValues: 70 50 20; | |
$hexColors: ( | |
"primary": #67486b, | |
"secondary": #749ee8 | |
); | |
// Lists are complex multi-level sass maps | |
$mappedItems: (primary, #67486B, 70 50), | |
(secondary, #749EE8, 80 40 20); | |
/** | |
* Generate CSS vars | |
*/ | |
:root { | |
// Simple maps = 👍 this works fine | |
@each $alphaValue in $alphaValues { | |
--color-alpha: #{$alphaValue * 0.001}; | |
} | |
@each $colorName, $hexColor in $hexColors { | |
--color-#{$colorName}: #{$hexColor}; | |
} | |
// ToDo: Trying to generate CSS vars for each $alphaValues of each $colorNames. | |
@each $colorName, $hexColor, $alphaValue in $mappedItems { | |
--color-#{$colorName}-alpha-#($alphaValue): rgba(#{$hexColor}, #{$alphaValue}%); | |
} | |
} |
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
:root { | |
--color-alpha: 0.07; | |
--color-alpha: 0.05; | |
--color-alpha: 0.02; | |
--color-primary: #67486b; | |
--color-secondary: #749ee8; | |
} |
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
{ | |
"sass": { | |
"compiler": "dart-sass/1.32.12", | |
"extensions": {}, | |
"syntax": "SCSS", | |
"outputStyle": "expanded" | |
}, | |
"autoprefixer": false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment