question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: mix() built-in function

See original GitHub issue

I’d like to see mix() implemented and added to the built-in functions. Both LESS and SASS has this function, so it’s only fair that Stylus should have it as well.

mix() is used to easily mix two colors, like this: mix(#35c32d, #264ef3, 20%)

Reference: SASS documentation

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
yuchicommented, Feb 2, 2012
mix(a, b, m)
  require-color a
  require-color b
  if unit(m) is '%'
    m = unit(m / 100, '')
  n = 1 - m
  return a * m +  b * n

Should do the job

0reactions
Fresheyeballcommented, Feb 6, 2013

when passing color variables into the mix method, stylus always returns black

   DPLight  = #e8eced 

   #div 
          background mix(DPLight,white,50%)

returns

  #div{ 
          background:#020202;  
  }

expected result

 #div{ 
         background: #f4f6f7;
 }

I am using stylus 0.31.0, if my version is out of date now, and its fixed, I apologize.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Features In-Depth | Less.js
Less extends CSS with dynamic behavior such as variables, mixins, operations and functions. Less runs on both the server-side (with Node.js and Rhino)...
Read more >
Introduction to Mix - The Elixir programming language
Mix is a build tool that ships with Elixir that provides tasks for creating, compiling, testing your application, managing its dependencies and much...
Read more >
Using mixins with class-based views - Django documentation
To get the object, DetailView relies on SingleObjectMixin , which provides a get_object() method that figures out the object based on the URL...
Read more >
Support `key` callback parameter for `min()`, `max()` starlark builtin ...
I light of #15122 - let me clarify how I see the feature needs to be implemented. Naturally, we do not want to...
Read more >
Triggers and bindings in Azure Functions | Microsoft Learn
You can mix and match different bindings to suit your needs. Bindings are optional and a function might have one or multiple input...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found