Giter VIP home page Giter VIP logo

Comments (6)

papandreou avatar papandreou commented on June 14, 2024

The only thing that has kept us from adding the list of standard CSS colors is that it would add precious kilobytes to the library. Maybe it could be in some kind of plugin and there could be a one-color-thefullmonty.js build?

from one-color.

papandreou avatar papandreou commented on June 14, 2024

I tried snatching the named color list from https://github.com/matthewbj/Colors/blob/master/colors.js and added it as an optional module. It adds 3430 bytes (1422 gzipped).

I pushed the code to the namedcolors branch. Now there's both a one-color.js and a one-color-all.js plus separate -debug versions.

Now you can go one.color('maroon').red(.4).hue(.6).

@Munter, please review.

from one-color.

dvdotsenko avatar dvdotsenko commented on June 14, 2024

"Maybe it could be in some kind of plugin" Yes, that is fare. It's just that without it doing things like parsing real-life web page CSS is not complete.

For https://github.com/willowsystems/jSignature we needed code that detects the colors from parent elem and computes mid-shades (between background and pen color) for decor like signature line.

Had to roll our own color parsing logic at the time and chose to ignore the named colors (just pick some grey for decor). My fingers are itching to roll in one-color + named colors as you seems to support HSL-based manipulation.

from one-color.

minikomi avatar minikomi commented on June 14, 2024

You can use canvas for browsers which support it to get the value as an rgb @papandreou

https://gist.github.com/1929015

from one-color.

Munter avatar Munter commented on June 14, 2024

@minikomi Thats a very neat idea. I think we'll need to keep it to the hardcoded list so far to be sure that we have universal browser support, at least for the default packages.
I can write it as a plugin which you can combine with the base class though, so the website author has the option to choose using the smaller canvas based variant :)

from one-color.

papandreou avatar papandreou commented on June 14, 2024

Added the named colors support in 2.1.0. It's part of the node.js package, but in the browser you need to use the one-color-all.js build.

from one-color.

Related Issues (20)

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.