Giter Site home page Giter Site logo

garex / nodejs-colors-to-less-operations Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 2.0 236 KB

Transforms colors to less operations that needs to be applied to the base color to get the desired color

Home Page: http://garex.github.io/nodejs-colors-to-less-operations/

License: MIT License

JavaScript 100.00%

nodejs-colors-to-less-operations's People

Contributors

garex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

etokareva

nodejs-colors-to-less-operations's Issues

Write tests for base transformations

All possible HSL operations:

  • spin +/-
  • saturate/desaturate
  • lighten/darken

Both colors same.

Bad color values?

Increase dependent version of color-model!

Describe API & write basic docs

/**
 * Transforms colors to less operations that needs to be applied to the base color
 * to get the desired color
 *
 * @see http://lesscss.org/functions/#color-operations
 * @param {String} baseColor
 * @param {String} desiredColor
 * @returns {String} For example: saturate(#ff8000, 20%); // #bf8040
 */
transformToLessOperations(baseColor, desiredColor)

Add github pages

What

Two text-boxes: left and right. In left user will enter source colors, and in right โ€” dependent.
After clicking button 'Gogogo', system will output in 3rd textbox/column/layer/section result of transformation.

For example:

  • #ff8000 entered in 1st column
  • #bf8040 โ€” in 2nd
  • then in 3rd we will have: "saturate(#ff8000, 20%); // #bf8040"

How

browserify main.js > dist/main.js

For browserify to work we need to remove:

  • conditional exports like

    module.exports = require(process.env.COLOR_MODEL_COVERAGE
    ? './.coverage/lib'
    : './lib'
    );

  • and all eval's like eval('var Rgb = require("./rgb")');

Same module can be installed in it's own node_modules from where browserify will take it to proceed with.

We can use some jquery or another here.

The error in the resulting color ~ 1%

@base-color: #428bca;
@needed-color: #5cb85c; // HSB: 120, 50, 72

Less-format:

spin(desaturate(lighten(#428bca, 1%), 17%), -88); 

Result-color:

#5ab75a;  // HSB: 120, 51, 72
// Result-color != @needed-color; S ~ 1%

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.