【问题标题】:Boostrap sass functions, (mix function in scss )?引导 sass 函数,(scss 中的混合函数)?
【发布时间】:2020-10-11 14:09:18
【问题描述】:

在 bootstrap-5 函数 scss 文件中,我们可以找到一个“mix”函数,我在 google 上没有找到。

我在哪里可以找到有关它的文档?

【问题讨论】:

标签: twitter-bootstrap sass bootstrap-5


【解决方案1】:

搜索 github 和 google 得到这个:mix -> colormix

还有javascript version of colormix:

    Color_RGBA* colormix(Context& ctx, SourceSpan& pstate, Color* color1, Color* color2, double weight) {
      Color_RGBA_Obj c1 = color1->toRGBA();
      Color_RGBA_Obj c2 = color2->toRGBA();
      double p = weight/100;
      double w = 2*p - 1;
      double a = c1->a() - c2->a();

      double w1 = (((w * a == -1) ? w : (w + a)/(1 + w*a)) + 1)/2.0;
      double w2 = 1 - w1;

      return SASS_MEMORY_NEW(Color_RGBA,
                             pstate,
                             Sass::round(w1*c1->r() + w2*c2->r(), ctx.c_options.precision),
                             Sass::round(w1*c1->g() + w2*c2->g(), ctx.c_options.precision),
                             Sass::round(w1*c1->b() + w2*c2->b(), ctx.c_options.precision),
                             c1->a()*p + c2->a()*(1-p));
    }

我想precision10 来自:

struct Sass_Inspect_Options {

  // Output style for the generated css code
  // A value from above SASS_STYLE_* constants
  enum Sass_Output_Style output_style;

  // Precision for fractional numbers
  int precision;

  // initialization list (constructor with defaults)
  Sass_Inspect_Options(Sass_Output_Style style = Sass::NESTED,
                       int precision = 10)
  : output_style(style), precision(precision)
  { }

};

【讨论】:

    猜你喜欢
    • 2016-08-21
    • 1970-01-01
    • 2017-11-16
    • 2021-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多