Comments (6)
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.
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.
"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.
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.
@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.
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)
- Implement color spaces: XYZ and CIE-L*ab HOT 9
- Eliminate color-namedColors.js in favor of DOM based solution? HOT 3
- In case jQuery exists, window.one.color is not set HOT 5
- New function doen't works for chrome apps HOT 4
- If onecolor hsl is initialized black, subsequent modifications yield invalid results HOT 3
- PhantomJS Support HOT 2
- Parsing CMYK percentages HOT 5
- Unnamed AMD module HOT 2
- Perceived Brightness HOT 5
- new Function() error in atom HOT 1
- Check that object is an instance of (any) Color HOT 1
- Output as 'hsv(...)' HOT 2
- About the source map files HOT 2
- Add new csswg color specification drafts to accepted syntaxes HOT 4
- Plans for P3 support? HOT 1
- Remove publishConfig from package.json HOT 3
- Validate is string a color HOT 1
- Module not found: Error: Can't resolve 'ONECOLOR' HOT 16
- LAB incorrectly converted HOT 4
- RGBA() like color parsing problem
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from one-color.