Skip to content

Instantly share code, notes, and snippets.

@starryeyez024
Last active September 7, 2018 03:49
Show Gist options
  • Select an option

  • Save starryeyez024/fe53b17275d6f66d07959609c0d34e05 to your computer and use it in GitHub Desktop.

Select an option

Save starryeyez024/fe53b17275d6f66d07959609c0d34e05 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.5.4)
// ----
////////////////////////////////////////////////////////////
// Crayola colors! elements/rh-sass/_colors.scss
$rh-red: #c00;
$rh-blue: #06c;
////////////////////////////////////////////////////////////
// Palette colors! themes/rh-theme/_colors.scss
$colors: (
--rh-palette--ui-accent: $rh-red,
--rh-palette--ui-complement: $rh-blue,
--rh-palette--ui-base: #ccc,
);
@each $cssvar, $sassvar in $colors {
:root {
#{$cssvar}: $sassvar;
}
}
@function rh-var($cssvar) {
@return var( #{$cssvar}, #{map-get($colors, $cssvar)});
}
// COMPONENTS
////////////////////////////////////////////////////////////
// Scss file for CTA Component, using palette colors = GOOD!
// these should be css vars
$rh-cta-main: rh-var(--rh-palette--ui-complement);
$rh-cta-aux: rh-var(--rh-palette--ui-base);
.cta {
color: $rh-cta-main;
background: $rh-cta-aux;
}
////////////////////////////////////////////////////////////
// Scss file for foo Component, using naughty sass vars
.foo {
color: $rh-red;
}
:root {
--rh-palette--ui-accent: #c00;
}
:root {
--rh-palette--ui-complement: #06c;
}
:root {
--rh-palette--ui-base: #ccc;
}
.cta {
color: var(--rh-palette--ui-complement, #06c);
background: var(--rh-palette--ui-base, #ccc);
}
.foo {
color: #c00;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment