Package Exports
- xolor
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (xolor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
xcolor
Automatically beautiful
An extensive color manipulation library for the browser and node.js. While extensive, this library is less than 6KB in size (minified and gzipped).
Calculating Colors
// Calculate a grey level color value
xolor('#c00').greyfilter()
// Calculate a gradient color between #fc0 and #f00 23% of the way through the gradient
xolor('#fc0').gradientlevel('#f00', .23)
// Calculate the visible color when lightgrey is overlayed on top of #f00 with an opacity of 69%.
xolor('#f00').opacity('lightgrey', 0.69)Colorizing Text
var element = document.getElementById('foo')
xolor.colorize(element, "burntsienna", "blue", function() {
// Colors each character a random color between "burntsienna" and "blue"
return Math.random()
})Further examples
This library was ported from the jquery xcolor plugin, and has all the non-jQuery related functionality that library had. Some great documentation for that library that will help understand the methods in this library, see the code examples and demonstrations here: http://www.xarg.org/project/jquery-color-plugin-xcolor/
Install
npm install xolorUsage
Accessing xolor:
// node.js
var xolor = require('xolor')
// amd
require.config({paths: {xolor: '../dist/xolor.umd.js'}})
require(['xolor'], function(xolor) { /* your code */ })
// global variable
<script src="xolor.umd.js"></script>
xolor; // xolor.umd.js can define xolor globally if you really
// want to shun module-based designUsing xolor:
Full usage docs on their way..
How to Contribute!
Anything helps:
- Creating issues (aka tickets/bugs/etc). Please feel free to use issues to report bugs, request features, and discuss changes
- Updating the documentation: ie this readme file. Be bold! Help create amazing documentation!
- Submitting pull requests.
How to submit pull requests:
- Please create an issue and get my input before spending too much time creating a feature. Work with me to ensure your feature or addition is optimal and fits with the purpose of the project.
- Fork the repository
- clone your forked repo onto your machine and run
npm installat its root - If you're gonna work on multiple separate things, its best to create a separate branch for each of them
- edit!
- If it's a code change, please add to the unit tests (at test/xolor.js) to verify that your change
- When you're done, run the unit tests and ensure they all pass
- Commit and push your changes
- Submit a pull request: https://help.github.com/articles/creating-a-pull-request
Change Log
- 1.1.0 - Changed lightness and relLightness from getter/setters to functions
- 1.0.0 - Created based on https://github.com/infusion/jQuery-xcolor
Todo
- documentation
- Incorporate more color methods from less.js
- Incorporate color methods from the "other useful javascript color modules"
- Write tests
Thanks
Thanks goes out to:
- Robert Eisele who's xColor jQuery plugin is where I got much of the code for this module.
License
Dual licensed under the MIT or GPL Version 2 licenses.
Other useful javacript color modules
These modules may have manipulation methods not contained in this library: