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
  1. Function

get-from-list()

@function get-from-list($list, $keys...) {
  $map: ();
  @if list.length($list) > 1 {
    $index: 1;

    @each $value in $list {
      @if type-of($value) != 'map' {
        $key: list.nth($keys, $index);
        @if type-of($key) == 'map' {
          @each $k, $type in $key {
            @if typeof($value) == $type {
              // @warn '#{$k} #{$type} #{$value}';
              $map: map.set($map, $k, $value);
            }
          }
        } @else {
          $map: map.set($map, $key, $value);
        }
        $index: $index + 1;
      }
    }

    @each $value in $list {
      @if type-of($value) == 'map' {
        @each $key in $keys {
          @if type-of($key) != 'map' {
            @if map.has-key($value, $key) {
              $map: map.set($map, $key, map.get($value, $key));
            }
          } @else {
            @each $k, $type in $key {
              @if typeof(map.get($value, $k)) == $type {
                $map: map.set($map, $k, map.get($value, $k));
              }
            }              
          }
        }
      }
    }
  } @else {
    $map: map.set($map, list.nth($keys, 1), $list);
  }
  @return $map;
}
Previousget-border()Nextimportant()

Last updated 2 years ago