From c05e34eb75de749faf15f0e362147a6add373625 Mon Sep 17 00:00:00 2001 From: Maxime Thirouin Date: Tue, 2 Jun 2015 06:45:54 +0200 Subject: [PATCH] 0.5.3 Close #13 --- CHANGELOG.md | 4 ++++ Gruntfile.js | 44 -------------------------------------------- README.md | 25 +++++++++++-------------- browser.js | 3 --- component.json | 16 ++++++++-------- package.json | 7 +------ 6 files changed, 24 insertions(+), 75 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 Gruntfile.js delete mode 100644 browser.js diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8608d57 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4 @@ +# 0.5.3 - 2015-06-02 + +- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]` +([#15](https://github.com/harthur/color-convert/issues/15)) diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index b52f8f4..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * To run this file: - * `npm install --dev` - * `npm install -g grunt` - * - * `grunt --help` - */ - -var fs = require("fs"), - browserify = require("browserify"), - pkg = require("./package.json"); - -module.exports = function(grunt) { - grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - uglify: { - options: { - banner: "/*\n" + grunt.file.read('LICENSE') + "\n*/" - }, - dist: { - files: { - '<%=pkg.name%>-<%=pkg.version%>.min.js': ['<%=pkg.name%>-<%=pkg.version%>.js'] - } - } - } - }); - - grunt.registerTask('build', 'build a browser file', function() { - var done = this.async(); - - var outfile = './color-convert-' + pkg.version + '.js'; - - var bundle = browserify('./browser.js').bundle(function(err, src) { - if (err) throw err; - - console.log("> " + outfile); - // write sync instead of piping to get around event bug - fs.writeFileSync(outfile, src); - done(); - }); - }); - - grunt.loadNpmTasks('grunt-contrib-uglify'); -}; diff --git a/README.md b/README.md index ef0e6d5..9c11426 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # color-convert [![Build Status](https://travis-ci.org/harthur/color-convert.svg?branch=master)](https://travis-ci.org/harthur/color-convert) Color-convert is a color conversion library for JavaScript and node. It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, and CSS keywords: -```javascript +```js var converter = require("color-convert")(); converter.rgb(140, 200, 100).hsl() // [96, 48, 59] @@ -11,20 +11,15 @@ converter.keyword("blue").rgb() // [0, 0, 255] # Install -### node - -For [node](http://nodejs.org) with [npm](http://npmjs.org): - - npm install color-convert - -### browser - -Download the latest [color-convert.js](http://github.com/harthur/color-convert/tree/gh-pages). All the methods are on the `colorConvert` object. +```console +npm install color-convert +``` # API + Color-convert exports a converter object with getter/setter methods for each color space. It caches conversions: -```javascript +```js var converter = require("color-convert")(); converter.rgb(140, 200, 100).hsl() // [96, 48, 59] @@ -35,26 +30,28 @@ converter.rgb([140, 200, 100]) // args can be an array ### Plain functions Get direct conversion functions with no fancy objects: -```javascript +```js require("color-convert").rgb2hsl([140, 200, 100]); // [96, 48, 59] ``` ### Unrounded To get the unrounded conversion, append `Raw` to the function name: -```javascript +```js convert.rgb2hslRaw([140, 200, 100]); // [95.99999999999999, 47.619047619047606, 58.82352941176471] ``` ### Hash There's also a hash of the conversion functions keyed first by the "from" color space, then by the "to" color space: -```javascript +```js convert["hsl"]["hsv"]([160, 0, 20]) == convert.hsl2hsv([160, 0, 20]) ``` ### Other spaces + There are some conversions from rgb (sRGB) to XYZ and LAB too, available as `rgb2xyz()`, `rgb2lab()`, `xyz2rgb()`, and `xyz2lab()`. # Contribute + Please fork, add conversions, figure out color profile stuff for XYZ, LAB, etc. This is meant to be a basic library that can be used by other libraries to wrap color calculations in some cool way. diff --git a/browser.js b/browser.js deleted file mode 100644 index 243a06e..0000000 --- a/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -// this file is the entrypoint for building a browser file with browserify - -colorConvert = require("./index"); \ No newline at end of file diff --git a/component.json b/component.json index ff8a8cb..c13fb12 100644 --- a/component.json +++ b/component.json @@ -1,9 +1,9 @@ { - "name": "color-convert", - "description": "Plain color conversion functions", - "version": "0.3.3", - "author": "Heather Arthur ", - "repository": "harthur/color-convert", - "keywords": ["color", "colour", "rgb"], - "scripts": ["index.js", "conversions.js"] -} \ No newline at end of file + "name": "color-convert", + "description": "Plain color conversion functions", + "version": "0.5.3", + "author": "Heather Arthur ", + "repository": "harthur/color-convert", + "keywords": ["color", "colour", "rgb"], + "scripts": ["index.js", "conversions.js"] +} diff --git a/package.json b/package.json index 658baf5..9125087 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,13 @@ { "name": "color-convert", "description": "Plain color conversion functions", - "version": "0.5.2", + "version": "0.5.3", "author": "Heather Arthur ", "repository": { "type": "git", "url": "http://github.com/harthur/color-convert.git" }, - "main": "./index", "devDependencies": { - "browserify": "^6.1.0", - "uglify-js": "1.0.x", - "grunt": "^0.4.5", - "grunt-contrib-uglify": "^0.6.0" }, "scripts": { "test": "node test/basic.js"