GithubHelp home page GithubHelp logo

isabella232 / less-plugin-advanced-color-functions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from less/less-plugin-advanced-color-functions

0.0 0.0 0.0 10 KB

Adds colour functions to less not provided by core

License: Apache License 2.0

JavaScript 95.21% CSS 4.79%

less-plugin-advanced-color-functions's Introduction

less-plugin-advanced-color-functions

Adds some advanced colour functions that helps in finding more contrasting colors:

  • invertluma: inverts the luma of a color giving a version darken or lighter than the original
  • contrastmore: if color1 and color2 have a similar luma, it contrast color2 a little bit more. If the color2 luma resultant is greater than 1, or less than 0, its luma is pivoted around color1 luma.
  • autocontrast: if color1 and color2 have a similar luma, it contrast color2 a little bit more. If the color2 luma resultant is greater than 1, or less than 0, its luma gets inverted.

lessc usage

npm install -g less-plugin-advanced-color-functions

and then on the command line,

lessc file.less --advanced-color-functions

Programmatic usage

var LessPluginAdvancedColorFunctions = require('less-plugin-advanced-color-functions'),
    AdvancedColorFunctions = new LessPluginAdvancedColorFunctions();
less.render(lessString, { plugins: [AdvancedColorFunctions] })
  .then(

Browser usage

Browser usage is not supported at this time.

Example

@color1: #ff0000;
@color2: #ee0000;

.colors {
invertluma: invertluma(@color1);
contrastmore: contrastmore(@color1,@color2);
autocontrast: autocontrast(@color1,@color2);
autocontrast50: autocontrast(@color1,@color2,50%);
}

outputs:

.colors {
  invertluma: #ff0000;
  contrastmore: #650000;
  autocontrast: #ff7878;
  autocontrast50: #ffdede;
}

The compiled coloures will look like that shown below: contrasting colours used in buttons

less-plugin-advanced-color-functions's People

Contributors

agriffis avatar bassjobsen avatar lukeapage avatar seven-phases-max avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.