Last active
April 7, 2019 18:22
-
-
Save starryeyez024/0e89306ac31e3cfb55a71c020c2af2a7 to your computer and use it in GitHub Desktop.
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
// ---- | |
// libsass (v3.5.4) | |
// ---- | |
$pfe-colors: ( | |
text: #222, | |
ui-link: #06c, | |
accent: #c00, | |
); | |
@function to-string($list, $glue: '', $is-nested: false) { | |
$result: null; | |
@for $i from 1 through length($list) { | |
$e: nth($list, $i); | |
@if type-of($e)==list { | |
$result: $result#{to-string($e, $glue, true)}; | |
} | |
@else { | |
$result: if($i !=length($list) or $is-nested, | |
$result#{$e}#{$glue}, | |
$result#{$e}); | |
} | |
} | |
@return $result; | |
} | |
@function pfe-color($cssvar, | |
$category: 'color', | |
$map: $pfe-colors) { | |
@if $category !="" { | |
$category: "#{$category}--"; | |
} | |
@return var(--pfe-theme--#{$category}#{$cssvar}, #{map-get($map, $cssvar)}); | |
} | |
/////////////////////////// | |
@function pfe-radio($cssvar...) { | |
@return var(--pfe-broadcasted--#{to-string($cssvar, '--')}); | |
} | |
@function pfe-radio-test($broadcast, $fallback) { | |
@return | |
var( | |
--pfe-broadcasted--color--#{to-string($broadcast,'--')}, | |
//--pfe-theme--color--#{to-string($fallback)} | |
#{pfe-color( | |
$fallback | |
)} | |
); | |
} | |
.foo { | |
color: #{pfe-radio(blue, red, green)}; | |
background-color: #{pfe-radio-test(ui-link, accent)}; | |
} |
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
.foo { | |
color: var(--pfe-broadcasted--blue--red--green); | |
background-color: var(--pfe-broadcasted--color--ui-link, var(--pfe-theme--color--accent, #c00)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment