Spectre.css
  • Introduction
  • ❤ Benefits
  • General concepts
  • Getting started
    • Skeleton
    • Installation
      • npm
    • Usage
  • Variables
    • Color scheme
    • CSS variable name
    • Using CSS variables
    • Colors
      • Settable SCSS
      • Based on settable SCSS
      • CSS variable color
      • Using CSS variable color
      • Color code
    • Other
  • CSS Color Classes
    • Background colors
    • Label colors
    • ⚠ Text colors
    • ⚠ Toast colors
  • Function
    • Color
      • alpha-var()
      • color()
      • color-name()
      • hsla-color()
      • hue-var()
      • lightness-level-var()
      • lightness-var()
      • saturation-var()
    • Var
      • css-var()
      • get-var()
      • size-var()
      • unit-var()
      • var-adjust()
      • var-name()
      • var-negative()
      • var-unit()
    • get-border()
    • get-from-list()
    • important()
    • map-get-default()
    • strip-unit()
    • typeof()
  • Mixin
    • Border
      • border()
      • border-hover()
      • border-variant()
    • Color
      • background()
      • background-color()
      • bg-color-variant()
      • color-active()
      • color-focus()
      • color-hover()
      • color-picker()
      • color-visited()
      • set-color()
      • set-var-alpha()
      • text-color-variant()
    • Label
      • label-base()
      • label-variant()
      • label-class-variant()
    • Margin
      • margin-size-variants()
      • margin-variant()
    • Padding
      • padding-size-variants()
      • padding-variant()
    • Text
      • text-ellipsis()
    • Toast
      • toast-variant()
      • ⚠ toast-class-variant()
    • Var
      • set-var()
      • set-vars()
      • ⚠ define-color()
      • ⚠ define-color-based-on()
    • avatar-base()
    • box-shadow-side()
    • button-variant()
    • clearfix()
    • control-shadow()
    • disabled()
    • hide-scrollbar()
    • property()
    • shadow-variant()
    • transition()
    • z-index()
  • Change log
    • Keep a changelog
    • CHANGELOG.md
  • GIT
    • Commit
    • Semantic Versioning
  • License
    • MIT
  • Social
    • Gettr
    • Twitter
    • YouTube
  • Contact
    • ⋯ Chat
    • @ Email
    • ✆ Phone
  • Donate
    • ฿ Cryptocurrency
    • $ Fiat
Powered by GitBook
On this page
  • Parameters
  • Example usage
  1. Mixin
  2. Color

bg-color-variant()

Previousbackground-color()Nextcolor-active()

Last updated 2 years ago

The mixin contains the two CSS classes, the CSS class of the name prefixed with bg-, and prefixed #{$prefix}-bg- with the given that includes the color of the given CSS variable name, and color style equal to light-color depending on whether the given SCSS variable lightness is below 60.

By default, is equal to the globally customizable .

The mixin contains additional CSS class that includes in its name global prefix $var-prefix.

.#{$prefix}-bg-#{$name}

src/mixins/color/_bg-color-variant.mixin.scss
@mixin bg-color-variant($name, $color, $hex-color, $prefix: $var-prefix) {
  .bg-#{$name},
  .#{$prefix}-bg-#{$name} {
    @include background($color, $important: !important);
    @if (lightness($hex-color) < 60) {
      @include color('light');
    }
  }
}

Parameters

$name: 'primary'

The suffix for the name of the contained CSS class .bg, by default it is set to primary.

$color: 'primary-color'

$hex-color: $primary-color

$prefix: $var-prefix

Example usage

// Get mixin.
@use 'node_modules/@angular-package/spectre.css/src/mixins/color' as *;

A color name that exists as a CSS variable of a string type is passed to the function to set the color.

The hex color of the given CSS variable name is used to add color style equal to light-color depending on whether its lightness is below 60. By default, it is set to the .

The parameter is to customize the prefix of the second contained CSS class name. By default, it is set to the global SASS variable .

color()
background
background
$name
$color
$hex-color
$prefix
$color
$var-prefix
$var-prefix
Logospectre.css/_color.scss at 1.0.x · angular-package/spectre.cssGitHub
$primary-color