MIX
  • 18 May 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

MIX

  • Dark
    Light
  • PDF

Returns a color that is a mix of the given two colors. By default the color is the average of the two colors. You may optionally define a ratio how much the returned color resembles the second color.

Function signature

MIX(color1: String, color2: String, ratio: Number = 0.5) => String
Parameter Description
Color 1 The first color to mix
Color 2 The second color to mix
Ratio Mix ratio (0...1)

Examples

Formula Return value
MIX("#fff", "#000", 0.5) rgb(180,180,180)
MIX("rgb(10, 20, 40)", "rgb(100, 100, 100)", 0.5) rgb(71,72,76)
MIX("hsl(80, 20%, 40%)", "hsl(80, 40%, 20%)") rgb(87,100,62)
MIX("red", "blue", 0.5) rgb(180,0,180)

Was this article helpful?

What's Next