Colors Sass在两种颜色之间混合调色板

Colors Sass在两种颜色之间混合调色板,colors,sass,Colors,Sass,我需要在Sass中创建一个mixin,它有3个参数($startingColor、$endingColor和$n-要创建的块数)。它必须是这两种颜色之间的色调过渡(调色板)。有人能帮我吗?:)好吧,半小时前我喜欢这个问题,但后来我意识到了sass的mix()功能。经过一番脑力激荡之后,它就在这里了 @mixin tonal-transition($x, $y, $c){ @for $i from 1 through $c { > * { &:nth-of-t

我需要在Sass中创建一个mixin,它有3个参数($startingColor、$endingColor和$n-要创建的块数)。它必须是这两种颜色之间的色调过渡(调色板)。有人能帮我吗?:)

好吧,半小时前我喜欢这个问题,但后来我意识到了sass的mix()功能。经过一番脑力激荡之后,它就在这里了

@mixin tonal-transition($x, $y, $c){
  @for $i from 1 through $c {
    > * {
      &:nth-of-type(#{$i}) {
        background: mix($y, $x, 100% * $i/$c);
      }
    }
  }
}

和。

请分享您迄今为止尝试过的代码示例,因此我认为您应该接受答案并结束主题。它似乎还开着。