Permalink
Browse files

rename from `has-color` to `supports-color`

  • Loading branch information...
1 parent ab671b1 commit 7aa2a1d2184044727b72b7f19f750177f4fdc4aa @sindresorhus sindresorhus committed Jun 14, 2014
Showing with 39 additions and 26 deletions.
  1. +2 −9 .jshintrc
  2. +21 −0 license
  3. +3 −2 package.json
  4. +8 −10 readme.md
  5. +5 −5 test.js
View
@@ -4,17 +4,10 @@
"bitwise": true,
"camelcase": true,
"curly": true,
- "eqeqeq": true,
"immed": true,
- "indent": 4,
- "latedef": true,
"newcap": true,
"noarg": true,
- "quotmark": "single",
- "regexp": true,
"undef": true,
- "unused": true,
- "strict": true,
- "trailing": true,
- "smarttabs": true
+ "unused": "vars",
+ "strict": true
}
View
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
@@ -1,9 +1,9 @@
{
- "name": "has-color",
+ "name": "supports-color",
"version": "0.1.7",
"description": "Detect whether a terminal supports color",
"license": "MIT",
- "repository": "sindresorhus/has-color",
+ "repository": "sindresorhus/supports-color",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@@ -34,6 +34,7 @@
"xterm",
"command-line",
"support",
+ "supports",
"capability",
"detect"
],
View
@@ -1,24 +1,22 @@
-# has-color [![Build Status](https://travis-ci.org/sindresorhus/has-color.svg?branch=master)](https://travis-ci.org/sindresorhus/has-color)
+# supports-color [![Build Status](https://travis-ci.org/sindresorhus/supports-color.svg?branch=master)](https://travis-ci.org/sindresorhus/supports-color)
-> Detect whether a terminal supports color.
-
-Used in the terminal color module [chalk](https://github.com/sindresorhus/chalk).
+> Detect whether a terminal supports color
## Install
-```bash
-$ npm install --save has-color
+```sh
+$ npm install --save supports-color
```
## Usage
```js
-var hasColor = require('has-color');
+var supportsColor = require('supports-color');
-if (hasColor) {
- console.log('Terminal supports color.');
+if (supportsColor) {
+ console.log('Terminal supports color');
}
```
@@ -27,4 +25,4 @@ It obeys the `--color` and `--no-color` CLI flags.
## License
-[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com)
+MIT © [Sindre Sorhus](http://sindresorhus.com)
View
@@ -3,28 +3,28 @@ var assert = require('assert');
beforeEach(function () {
// clear the cache of the tested module
- delete require.cache[require.resolve('./index')];
+ delete require.cache[require.resolve('./')];
process.stdout.isTTY = true;
process.argv = [];
process.env = {};
});
it('should return false if not TTY', function () {
process.stdout.isTTY = false;
- assert.equal(require('./index'), false);
+ assert.equal(require('./'), false);
});
it('should return false if --no-color flag is used', function () {
process.argv = ['--no-color'];
- assert.equal(require('./index'), false);
+ assert.equal(require('./'), false);
});
it('should return true if --color flag is used', function () {
process.argv = ['--color'];
- assert.equal(require('./index'), true);
+ assert.equal(require('./'), true);
});
it('should return true if `COLORTERM` is in env', function () {
process.env.COLORTERM = true;
- assert.equal(require('./index'), true);
+ assert.equal(require('./'), true);
});

0 comments on commit 7aa2a1d

Please sign in to comment.