How to use the stylus.functions function in stylus

To help you get started, we’ve selected a few stylus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OnsenUI / onsen-css-components / server / stylusCompiler.js View on Github external
var myalpha = function(color, value) {
    if (color.string && color.string.indexOf('$') === 0) {
      return color;
    }
    else {
      color = color.rgba;
      if (value) {
        return stylus.functions.rgba(
          new stylus.nodes.Unit(color.r),
          new stylus.nodes.Unit(color.g),
          new stylus.nodes.Unit(color.b),
          value
        );
      }
      return new stylus.nodes.Unit(color.a, '');
    }
  };
github OnsenUI / OnsenUI / css-components / server / stylusCompiler.js View on Github external
var myalpha = function(color, alpha) {
    if (color.string.indexOf('$') === 0) {
      return color;
    }
    else {
      color = color.rgba;
      if (value) {
        return stylus.functions.rgba(
          new stylus.nodes.Unit(color.r),
          new stylus.nodes.Unit(color.g),
          new stylus.nodes.Unit(color.b),
          value
        );
      }
      return new stylus.nodes.Unit(color.a, '');
    }
  };