zoukankan      html  css  js  c++  java
  • [SCSS] Access Theme Color Values With Sass

    Manage the color palette used in your stylesheets by creating a map of variables and a function to access the values by key. This allows you to update the colors in one location to re-theme your application and eliminate manual find and replace.

    $color-primary: indigo;
    $color-secondary: blue;
    $color-support: deeppink;
    
    $theme-colors: (
      primary: $color-primary,
      secondary: $color-secondary,
      support: $color-support
    );
    
    @function theme-color($key) {
      @return map-get($theme-colors, $key);
    }
    
    
    h1 {
      color: theme-color(primary);
    }
    
    a {
      background-color: theme-color(support);
      color: #fff;
      border-radius: 8px;
      text-decoration: none;
      padding: 0.25em 0.75em;
    
      &:hover {
        background-color: scale-color(theme-color(support), $lightness: -30%);
      }
    }
  • 相关阅读:
    2019.1.5JavaScript
    SQL常用删改增语句
    PHP连接数据库
    PHP数组函数
    PHP字符串常用函数
    PHP 类型判断方法
    jQuery效果
    jQuery特性
    倒计时
    判断浏览器及其内核
  • 原文地址:https://www.cnblogs.com/Answer1215/p/12914353.html
Copyright © 2011-2022 走看看