SlideShare a Scribd company logo
Tudor Barbu
@motanelu
#bcnjs
@bcnjs
github.com/barcelonaJS/speakers
h1 {
color: #EB9406;
margin-bottom: 10px;
}
h2 {
color: #1D72DB;
margin-bottom: 5px;
line-height: 16px;
font-size: 14px;
}
p {
margin-bottom: 5px;
line-height: 16px;
font-size: 14px;
}
img {
border: solid 2px #EB9406;
}
a {
color: #EB9406;
}
Same color
Same typography
h1 {
color: #CC0000;
margin-bottom: 10px;
}
h2 {
color: #1D72DB;
margin-bottom: 5px;
line-height: 16px;
font-size: 14px;
}
p {
margin-bottom: 5px;
line-height: 16px;
font-size: 14px;
}
img {
border: solid 2px #EB9406;
}
a {
color: #CC0000;
}
#EB9406
#CC0000
$font-stack: Helvetica, sans-serif
$primary-color: #333
body
font: 100% $font-stack
color: $primary-color
=transform($property)
-webkit-transform: $property
-ms-transform: $property
transform: $property
.box
+include transform(rotate(30deg))
$font-stack: Helvetica, sans-serif;
$primary-color: #333;
body {
font: 100% $font-stack;
color: $primary-color;
}
@mixin transform($property) {
-webkit-transform: $property;
-ms-transform: $property;
transform: $property;
}
.box {
@include transform(rotate(30deg));
}
Sass SCSS - Sassy CSS
h1 {
color: #EB9406;
margin-bottom: 10px;
}
h2 {
color: #1D72DB;
margin-bottom: 5px;
line-height: 16px;
font-size: 14px;
}
p {
margin-bottom: 5px;
line-height: 16px;
font-size: 14px;
}
img {
border: solid 2px #EB9406;
}
a {
color: #EB9406;
}
$primary-color: #EB9406;
$secondary-color: #1D72DB;
@mixin typography() {
margin-bottom: 5px;
line-height: 16px;
font-size: 14px;
}
h1 {
color: $primary-color;
margin-bottom: 10px;
}
h2 {
color: $secondary-color;
@include typography();
}
p {
@include typography();
}
img {
border: solid 2px $primary-color;
}
a {
color: $primary-color;
}
primary
secondary
accent
success
error
warning
info
neutral
normal hover active disabled
Same “distance” between colors
#94A7BC#BFCAD7 #1D72DB #294F78 #15283C#1F3B5A #0C1824
… …
#91D6DC#BDE6EA #5AC2CA #23ADB8 #12575C#1A828A #0B3437
… …
#ECD9B8#F4E8D4 #E3C595 #A2C678 #6D5939#A38655 #413522
… …
…
$color_primary: #294F78;
$color_secondary: #23ADB8;
/* ... */
$color_alert: #A2C678;
$darker_shades = [25%, 50%, ...];
$lighter_shades = [25%, 50%, ...];
$color_primary_D1: #1F3B5A;
$color_primary_D2: #15283C;
$color_primary_D3: #0C1824;
$color_primary_L1: #1D72DB;
$color_primary_L2: #94A7BC;
$color_primary_L3: #BFCAD7;
$color_secondary_D1 = #1A828A;
/* ... */
$tokens = (
color_primary: #294F78,
color_secondary: #23ADB8,
/* ... */
color_alert: #A2C678,
);
$tokens = (
color_primary: #294F78,
color_secondary: #23ADB8,
/* ... */
color_alert: #A2C678,
color_primary_D1: #1F3B5A,
color_primary_D2: #15283C,
color_primary_D3: #0C1824,
color_primary_L1: #1D72DB,
color_primary_L2: #94A7BC,
color_primary_L3: #BFCAD7,
color_secondary_D1: #1A828A
/* ... */
);
@function delta-shades(
$tokens,
$colors: color_primary color_secondary color_accent color_success color_alert color_error color_info,
$dark-shades: ( D1: 25%, D2: 50%, D3: 70%, D4: 90% ),
$light-shades: ( L1: 25%, L2: 50%, L3: 70%, L4: 90% )
) {
$temp: ();
@each $color in $colors {
@each $shade, $percentage in $dark-shades {
$temp: map-merge(
$temp,
('#{$color}-#{$shade}': mix(black, map-get($tokens, $color), $percentage))
);
}
@each $shade, $percentage in $light-shades {
$temp: map-merge(
$temp,
('#{$color}-#{$shade}': mix(white, map-get($tokens, $color), $percentage))
);
}
}
@return $temp;
};
$palette: (
color-primary: #2b91c1,
color-secondary: #d57c1b,
color-accent: #00cea5,
color-success: #8bc34a,
color-alert: #f5a623,
color-error: #f44c23,
color-info: #0d79ff
);
$palette: delta-shades($palette);
.primary-button:hover {
background-color: map-get($palette, color-primary_D1);
}
.secondary-button:hover {
background-color: map-get($palette, color-secondary_D1);
}
OMG!
It works!
Does it really?
yarn add sass-true --dev
@import 'true';
@import '../../src/scss/delta-shades.scss';
@include describe('delta-shades()') {
@include it('runs with custom parameters') {
$palette: (
color_primary: #f442d1,
color_secondary: #f4b841
);
$shades: delta-shades($palette, color_primary color_secondary,
(DS1: 30%, DS2: 60%), (LS1: 30%, LS2: 60%)
);
@include assert-equal(
map-get($shades, color_primary-DS2), mix(black, #f442d1, 60%)
);
@include assert-equal(
map-get($shades, color_primary-LS1), mix(white, #f442d1, 30%)
);
@include assert-equal(
map-get($shades, color_secondary-LS2), mix(white, #f4b841, 60%)
);
}
}
.delta-badge__large {
font-size: var(--delta-badge-large_font-size);
font-weight: var(--delta-badge-large_font-weight);
line-height: var(--delta-badge-large_height);
padding: 0 var(--delta-badge-large_padding);
}
.delta-badge__large {
font-size: 14px;
font-weight: bold;
line-height: 32px;
padding: 0 8px;
}
:root {
--delta-badge-large_font-size: 14px;
--delta-badge-large_font-weight: bold;
--delta-badge-large_height: 32px;
--delta-badge-large_padding: 8px;
}
@function delta-var($key, $tokens, $export-prefix) {
$use-css-vars: false;
@if (variable_exists(DELTA-USE-CSS-VARS)) {
$use-css-vars: $DELTA-USE-CSS-VARS;
}
@if ($use-css-vars == true) {
@return var(--#{$export-prefix}-#{$key});
} @else {
@return map-get($tokens, $key);
}
}
$tokens: (
large_font-size: 14px,
large_font-weight: bold;
large_height: 32px;
large_padding: 8px;
);
.delta-badge__large {
font-size: delta-var(large_font-size, $tokens, delta-badge);
font-weight: delta-var(large_font-weight, $tokens, delta-badge);
line-height: delta-var(large_height, $tokens, delta-badge);
padding: 0 delta-var(large_padding, $tokens, delta-badge);
}
.delta-badge__large {
font-size: 14px;
font-weight: bold;
line-height: 32px;
padding: 0 8px;
}
.delta-badge__large {
font-size: var(--delta-badge-large_font-size);
font-weight: var(--delta-badge-large_font-weight);
line-height: var(--delta-badge-large_height);
padding: 0 var(--delta-badge-large_padding);
}
$DELTA-USE-CSS-VARS: true;
@import 'true';
@import '../../src/scss/delta-var.scss';
@include describe('delta-var()') {
$map: (
primary_color: black,
font_size: 14px
);
@include it('renders CSS values when the flag is false') {
$DELTA-USE-CSS-VARS: false !global;
@include assert() {
@include output {
color: delta-var(primary_color, $map, delta-token);
font-size: delta-var(font_size, $map, delta-token);
}
@include expect {
color: black;
font-size: 14px;
}
}
}
@include it('renders CSS variables when the flag is true') {
$DELTA-USE-CSS-VARS: true !global;
@include assert() {
@include output {
color: delta-var(primary_color, $map, delta-token);
font-size: delta-var(font_size, $map, delta-token);
}
@include expect {
color: var(--delta-token-primary_color);
font-size: var(--delta-token-font_size);
}
}
}
}
●
●
●
Finding the sassy in sass

More Related Content

Similar to Finding the sassy in sass

Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & Compass
Andreas Dantz
 
FCIP SASS Talk
FCIP SASS TalkFCIP SASS Talk
FCIP SASS Talk
Chris Schneider
 
How to Use Sass to Make Your Site More Maintainable
How to Use Sass to Make Your Site More MaintainableHow to Use Sass to Make Your Site More Maintainable
How to Use Sass to Make Your Site More Maintainable
Scott Vandehey
 
Sass
SassSass
Sass, Compass
Sass, CompassSass, Compass
Sass, Compass
Serg Diniovskiy
 
Stylesheets of the future with Sass and Compass
Stylesheets of the future with Sass and CompassStylesheets of the future with Sass and Compass
Stylesheets of the future with Sass and Compass
Dave Ross
 
Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
Rob Friesel
 
Tmx9
Tmx9Tmx9
Sass - Making CSS fun again.
Sass - Making CSS fun again.Sass - Making CSS fun again.
Sass - Making CSS fun again.
Gabriel Neutzling
 
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsMobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Kaelig Deloumeau-Prigent
 
abosweed.R57
abosweed.R57abosweed.R57
abosweed.R57
gueste2a0ba20
 
常用的CSS样式备份精华
常用的CSS样式备份精华常用的CSS样式备份精华
常用的CSS样式备份精华
wensheng wei
 
Chapter 6 TemplateWeek 6csshomework.css html {.docx
Chapter 6 TemplateWeek 6csshomework.css  html {.docxChapter 6 TemplateWeek 6csshomework.css  html {.docx
Chapter 6 TemplateWeek 6csshomework.css html {.docx
robertad6
 
Finding a Better Way to CSS: Navigating Sass with Compass
Finding a Better Way to CSS: Navigating Sass with CompassFinding a Better Way to CSS: Navigating Sass with Compass
Finding a Better Way to CSS: Navigating Sass with Compass
Claudina Sarahe
 
Compass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS DeveloperCompass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS Developer
Wynn Netherland
 
Bloggdesign #2 - hawaa.blogg.no
Bloggdesign #2 - hawaa.blogg.noBloggdesign #2 - hawaa.blogg.no
Bloggdesign #2 - hawaa.blogg.no
Hannee92
 
Theme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copieTheme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copie
Rafaela Souza
 
Theme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copieTheme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copie
Rafaela Souza
 
Chapter 13: Colors and Backgrounds
Chapter 13: Colors and BackgroundsChapter 13: Colors and Backgrounds
Chapter 13: Colors and Backgrounds
Steve Guinan
 
Software programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesSoftware programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS files
Dinu Suman
 

Similar to Finding the sassy in sass (20)

Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & Compass
 
FCIP SASS Talk
FCIP SASS TalkFCIP SASS Talk
FCIP SASS Talk
 
How to Use Sass to Make Your Site More Maintainable
How to Use Sass to Make Your Site More MaintainableHow to Use Sass to Make Your Site More Maintainable
How to Use Sass to Make Your Site More Maintainable
 
Sass
SassSass
Sass
 
Sass, Compass
Sass, CompassSass, Compass
Sass, Compass
 
Stylesheets of the future with Sass and Compass
Stylesheets of the future with Sass and CompassStylesheets of the future with Sass and Compass
Stylesheets of the future with Sass and Compass
 
Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
 
Tmx9
Tmx9Tmx9
Tmx9
 
Sass - Making CSS fun again.
Sass - Making CSS fun again.Sass - Making CSS fun again.
Sass - Making CSS fun again.
 
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsMobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
 
abosweed.R57
abosweed.R57abosweed.R57
abosweed.R57
 
常用的CSS样式备份精华
常用的CSS样式备份精华常用的CSS样式备份精华
常用的CSS样式备份精华
 
Chapter 6 TemplateWeek 6csshomework.css html {.docx
Chapter 6 TemplateWeek 6csshomework.css  html {.docxChapter 6 TemplateWeek 6csshomework.css  html {.docx
Chapter 6 TemplateWeek 6csshomework.css html {.docx
 
Finding a Better Way to CSS: Navigating Sass with Compass
Finding a Better Way to CSS: Navigating Sass with CompassFinding a Better Way to CSS: Navigating Sass with Compass
Finding a Better Way to CSS: Navigating Sass with Compass
 
Compass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS DeveloperCompass, Sass, and the Enlightened CSS Developer
Compass, Sass, and the Enlightened CSS Developer
 
Bloggdesign #2 - hawaa.blogg.no
Bloggdesign #2 - hawaa.blogg.noBloggdesign #2 - hawaa.blogg.no
Bloggdesign #2 - hawaa.blogg.no
 
Theme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copieTheme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copie
 
Theme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copieTheme futura suicida não use como base e nem copie
Theme futura suicida não use como base e nem copie
 
Chapter 13: Colors and Backgrounds
Chapter 13: Colors and BackgroundsChapter 13: Colors and Backgrounds
Chapter 13: Colors and Backgrounds
 
Software programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesSoftware programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS files
 

More from Tudor Barbu

Web components
Web componentsWeb components
Web components
Tudor Barbu
 
Modern frontend development with VueJs
Modern frontend development with VueJsModern frontend development with VueJs
Modern frontend development with VueJs
Tudor Barbu
 
Building a js widget
Building a js widgetBuilding a js widget
Building a js widget
Tudor Barbu
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabs
Tudor Barbu
 
Logging with Monolog
Logging with MonologLogging with Monolog
Logging with Monolog
Tudor Barbu
 
CI / CD w/ Codeception
CI / CD w/ CodeceptionCI / CD w/ Codeception
CI / CD w/ Codeception
Tudor Barbu
 
Hack UPC
Hack UPCHack UPC
Hack UPC
Tudor Barbu
 

More from Tudor Barbu (7)

Web components
Web componentsWeb components
Web components
 
Modern frontend development with VueJs
Modern frontend development with VueJsModern frontend development with VueJs
Modern frontend development with VueJs
 
Building a js widget
Building a js widgetBuilding a js widget
Building a js widget
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabs
 
Logging with Monolog
Logging with MonologLogging with Monolog
Logging with Monolog
 
CI / CD w/ Codeception
CI / CD w/ CodeceptionCI / CD w/ Codeception
CI / CD w/ Codeception
 
Hack UPC
Hack UPCHack UPC
Hack UPC
 

Recently uploaded

How to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdfHow to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdf
Infosec train
 
cyber crime.pptx..........................
cyber crime.pptx..........................cyber crime.pptx..........................
cyber crime.pptx..........................
GNAMBIKARAO
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
rtunex8r
 
Bangalore Call Girls 9079923931 With -Cuties' Hot Call Girls
Bangalore Call Girls 9079923931 With -Cuties' Hot Call GirlsBangalore Call Girls 9079923931 With -Cuties' Hot Call Girls
Bangalore Call Girls 9079923931 With -Cuties' Hot Call Girls
narwatsonia7
 
Decentralized Justice in Gaming and Esports
Decentralized Justice in Gaming and EsportsDecentralized Justice in Gaming and Esports
Decentralized Justice in Gaming and Esports
Federico Ast
 
KubeCon & CloudNative Con 2024 Artificial Intelligent
KubeCon & CloudNative Con 2024 Artificial IntelligentKubeCon & CloudNative Con 2024 Artificial Intelligent
KubeCon & CloudNative Con 2024 Artificial Intelligent
Emre Gündoğdu
 
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
thezot
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
3a0sd7z3
 
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
dtagbe
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
Tarandeep Singh
 
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
APNIC
 
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
APNIC
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
3a0sd7z3
 

Recently uploaded (13)

How to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdfHow to make a complaint to the police for Social Media Fraud.pdf
How to make a complaint to the police for Social Media Fraud.pdf
 
cyber crime.pptx..........................
cyber crime.pptx..........................cyber crime.pptx..........................
cyber crime.pptx..........................
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
 
Bangalore Call Girls 9079923931 With -Cuties' Hot Call Girls
Bangalore Call Girls 9079923931 With -Cuties' Hot Call GirlsBangalore Call Girls 9079923931 With -Cuties' Hot Call Girls
Bangalore Call Girls 9079923931 With -Cuties' Hot Call Girls
 
Decentralized Justice in Gaming and Esports
Decentralized Justice in Gaming and EsportsDecentralized Justice in Gaming and Esports
Decentralized Justice in Gaming and Esports
 
KubeCon & CloudNative Con 2024 Artificial Intelligent
KubeCon & CloudNative Con 2024 Artificial IntelligentKubeCon & CloudNative Con 2024 Artificial Intelligent
KubeCon & CloudNative Con 2024 Artificial Intelligent
 
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
一比一原版新西兰林肯大学毕业证(Lincoln毕业证书)学历如何办理
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
 
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
一比一原版(uc毕业证书)加拿大卡尔加里大学毕业证如何办理
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
 
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...Securing BGP: Operational Strategies and Best Practices for Network Defenders...
Securing BGP: Operational Strategies and Best Practices for Network Defenders...
 
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
Honeypots Unveiled: Proactive Defense Tactics for Cyber Security, Phoenix Sum...
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
 

Finding the sassy in sass

  • 3.
  • 4.
  • 6.
  • 7.
  • 8.
  • 9. h1 { color: #EB9406; margin-bottom: 10px; } h2 { color: #1D72DB; margin-bottom: 5px; line-height: 16px; font-size: 14px; } p { margin-bottom: 5px; line-height: 16px; font-size: 14px; } img { border: solid 2px #EB9406; } a { color: #EB9406; } Same color Same typography
  • 10.
  • 11. h1 { color: #CC0000; margin-bottom: 10px; } h2 { color: #1D72DB; margin-bottom: 5px; line-height: 16px; font-size: 14px; } p { margin-bottom: 5px; line-height: 16px; font-size: 14px; } img { border: solid 2px #EB9406; } a { color: #CC0000; } #EB9406 #CC0000
  • 12.
  • 13.
  • 14. $font-stack: Helvetica, sans-serif $primary-color: #333 body font: 100% $font-stack color: $primary-color =transform($property) -webkit-transform: $property -ms-transform: $property transform: $property .box +include transform(rotate(30deg)) $font-stack: Helvetica, sans-serif; $primary-color: #333; body { font: 100% $font-stack; color: $primary-color; } @mixin transform($property) { -webkit-transform: $property; -ms-transform: $property; transform: $property; } .box { @include transform(rotate(30deg)); } Sass SCSS - Sassy CSS
  • 15.
  • 16.
  • 17. h1 { color: #EB9406; margin-bottom: 10px; } h2 { color: #1D72DB; margin-bottom: 5px; line-height: 16px; font-size: 14px; } p { margin-bottom: 5px; line-height: 16px; font-size: 14px; } img { border: solid 2px #EB9406; } a { color: #EB9406; } $primary-color: #EB9406; $secondary-color: #1D72DB; @mixin typography() { margin-bottom: 5px; line-height: 16px; font-size: 14px; } h1 { color: $primary-color; margin-bottom: 10px; } h2 { color: $secondary-color; @include typography(); } p { @include typography(); } img { border: solid 2px $primary-color; } a { color: $primary-color; }
  • 18.
  • 19.
  • 21. #94A7BC#BFCAD7 #1D72DB #294F78 #15283C#1F3B5A #0C1824 … … #91D6DC#BDE6EA #5AC2CA #23ADB8 #12575C#1A828A #0B3437 … … #ECD9B8#F4E8D4 #E3C595 #A2C678 #6D5939#A38655 #413522 … … …
  • 22. $color_primary: #294F78; $color_secondary: #23ADB8; /* ... */ $color_alert: #A2C678; $darker_shades = [25%, 50%, ...]; $lighter_shades = [25%, 50%, ...]; $color_primary_D1: #1F3B5A; $color_primary_D2: #15283C; $color_primary_D3: #0C1824; $color_primary_L1: #1D72DB; $color_primary_L2: #94A7BC; $color_primary_L3: #BFCAD7; $color_secondary_D1 = #1A828A; /* ... */
  • 23.
  • 24. $tokens = ( color_primary: #294F78, color_secondary: #23ADB8, /* ... */ color_alert: #A2C678, ); $tokens = ( color_primary: #294F78, color_secondary: #23ADB8, /* ... */ color_alert: #A2C678, color_primary_D1: #1F3B5A, color_primary_D2: #15283C, color_primary_D3: #0C1824, color_primary_L1: #1D72DB, color_primary_L2: #94A7BC, color_primary_L3: #BFCAD7, color_secondary_D1: #1A828A /* ... */ );
  • 25. @function delta-shades( $tokens, $colors: color_primary color_secondary color_accent color_success color_alert color_error color_info, $dark-shades: ( D1: 25%, D2: 50%, D3: 70%, D4: 90% ), $light-shades: ( L1: 25%, L2: 50%, L3: 70%, L4: 90% ) ) { $temp: (); @each $color in $colors { @each $shade, $percentage in $dark-shades { $temp: map-merge( $temp, ('#{$color}-#{$shade}': mix(black, map-get($tokens, $color), $percentage)) ); } @each $shade, $percentage in $light-shades { $temp: map-merge( $temp, ('#{$color}-#{$shade}': mix(white, map-get($tokens, $color), $percentage)) ); } } @return $temp; };
  • 26. $palette: ( color-primary: #2b91c1, color-secondary: #d57c1b, color-accent: #00cea5, color-success: #8bc34a, color-alert: #f5a623, color-error: #f44c23, color-info: #0d79ff ); $palette: delta-shades($palette); .primary-button:hover { background-color: map-get($palette, color-primary_D1); } .secondary-button:hover { background-color: map-get($palette, color-secondary_D1); }
  • 29.
  • 31. @import 'true'; @import '../../src/scss/delta-shades.scss'; @include describe('delta-shades()') { @include it('runs with custom parameters') { $palette: ( color_primary: #f442d1, color_secondary: #f4b841 ); $shades: delta-shades($palette, color_primary color_secondary, (DS1: 30%, DS2: 60%), (LS1: 30%, LS2: 60%) ); @include assert-equal( map-get($shades, color_primary-DS2), mix(black, #f442d1, 60%) ); @include assert-equal( map-get($shades, color_primary-LS1), mix(white, #f442d1, 30%) ); @include assert-equal( map-get($shades, color_secondary-LS2), mix(white, #f4b841, 60%) ); } }
  • 32.
  • 33. .delta-badge__large { font-size: var(--delta-badge-large_font-size); font-weight: var(--delta-badge-large_font-weight); line-height: var(--delta-badge-large_height); padding: 0 var(--delta-badge-large_padding); } .delta-badge__large { font-size: 14px; font-weight: bold; line-height: 32px; padding: 0 8px; } :root { --delta-badge-large_font-size: 14px; --delta-badge-large_font-weight: bold; --delta-badge-large_height: 32px; --delta-badge-large_padding: 8px; }
  • 34. @function delta-var($key, $tokens, $export-prefix) { $use-css-vars: false; @if (variable_exists(DELTA-USE-CSS-VARS)) { $use-css-vars: $DELTA-USE-CSS-VARS; } @if ($use-css-vars == true) { @return var(--#{$export-prefix}-#{$key}); } @else { @return map-get($tokens, $key); } }
  • 35. $tokens: ( large_font-size: 14px, large_font-weight: bold; large_height: 32px; large_padding: 8px; ); .delta-badge__large { font-size: delta-var(large_font-size, $tokens, delta-badge); font-weight: delta-var(large_font-weight, $tokens, delta-badge); line-height: delta-var(large_height, $tokens, delta-badge); padding: 0 delta-var(large_padding, $tokens, delta-badge); } .delta-badge__large { font-size: 14px; font-weight: bold; line-height: 32px; padding: 0 8px; } .delta-badge__large { font-size: var(--delta-badge-large_font-size); font-weight: var(--delta-badge-large_font-weight); line-height: var(--delta-badge-large_height); padding: 0 var(--delta-badge-large_padding); } $DELTA-USE-CSS-VARS: true;
  • 36. @import 'true'; @import '../../src/scss/delta-var.scss'; @include describe('delta-var()') { $map: ( primary_color: black, font_size: 14px ); @include it('renders CSS values when the flag is false') { $DELTA-USE-CSS-VARS: false !global; @include assert() { @include output { color: delta-var(primary_color, $map, delta-token); font-size: delta-var(font_size, $map, delta-token); } @include expect { color: black; font-size: 14px; } } } @include it('renders CSS variables when the flag is true') { $DELTA-USE-CSS-VARS: true !global; @include assert() { @include output { color: delta-var(primary_color, $map, delta-token); font-size: delta-var(font_size, $map, delta-token); } @include expect { color: var(--delta-token-primary_color); font-size: var(--delta-token-font_size); } } } }
  • 37.