[SCSS] Use standard built-in SCSS Functions for Common Operations

Source: Internet
Author: User

We can use JavaScript for color and opacity variations, math, list and map logic or to see if something exists. SCSS includes functions for a wide range of common use cases for logic in our styles. In this lesson we look at some of the + useful color functions to improve development velocity, readability, and simpli FY the code. Be sure to checkout all the SCSS functions:http://sass-lang.com/documentation/sass/script/functions.html

$base: #24ea12, $lighten _base:lighten ($base, 25%), $darken _base:darken ($base, 25%); $CLB: Complement ($base); $cllb : Complement ($lighten _base); $cldb: Complement ($darken _base); $light-color:scale_color ($base, $alpha:-50%); $ Dark-color:scale_color ($base, $saturation:-35%);. Base{Background-color:$base;Color:$CLB;}. Lighten_base{Background-color:$lighten _base;Color:$cllb;}. Darken_base{Background-color:$darken _base;Color:$cldb;}. Linear-gradient{Background-image:linear-gradient ($CLB, $CLLB, $cldb);Color:Mix ($base, yellow, 25%);}. Hover{Background-image:linear-gradient ($base, $lighten _base, $darken _base);Color:Mix ($base, yellow, 25%);&:Hover {color:transparentize (Mix ($base, yellow, 25%),. 5);//Based on given color, add 0.5 opacity}}.darken-color{Color:$dark-color;}. Lighten-color{Color:$light-color;}. Container{Display:Grid;Grid-gap:10px;Grid-template-columns:1fr 1fr 1fr;Counter-reset:Box;Height:100VH;}. Box:before{counter-increment:Box;font-size:3em;content:counter (box);}. Box{Display:Flex;justify-content:Center;align-content:Center;Align-items:Center;}

Github

[SCSS] Use standard built-in SCSS Functions for Common Operations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.