[Pkg-javascript-commits] [node-ansi-styles] 01/02: Imported Upstream version 1.1.0

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Sun Jun 29 19:57:03 UTC 2014


This is an automated email from the git hooks/post-receive script.

andrewrk-guest pushed a commit to branch master
in repository node-ansi-styles.

commit 7a5379d0b6a3f723ed4d224c53ab0763ac3752b8
Author: Andrew Kelley <superjoe30 at gmail.com>
Date:   Sun Jun 29 19:51:28 2014 +0000

    Imported Upstream version 1.1.0
---
 .editorconfig  |  16 +++++++++++++
 .gitattributes |   1 +
 .gitignore     |   1 +
 .jshintrc      |  16 +++++++++++++
 .travis.yml    |   3 +++
 index.js       |  40 +++++++++++++++++++++++++++++++++
 license        |  21 +++++++++++++++++
 package.json   |  46 +++++++++++++++++++++++++++++++++++++
 readme.md      |  70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 screenshot.png | Bin 0 -> 51858 bytes
 test.js        |  26 +++++++++++++++++++++
 11 files changed, 240 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..8311fe1
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,16 @@
+# editorconfig.org
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[package.json]
+indent_style = space
+indent_size = 2
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..176a458
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text=auto
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..c511975
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,16 @@
+{
+	"node": true,
+	"esnext": true,
+	"bitwise": true,
+	"camelcase": true,
+	"curly": true,
+	"eqeqeq": true,
+	"immed": true,
+	"indent": 4,
+	"newcap": true,
+	"noarg": true,
+	"quotmark": "single",
+	"undef": true,
+	"unused": "vars",
+	"strict": true
+}
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..244b7e8
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+  - '0.10'
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..2d8b472
--- /dev/null
+++ b/index.js
@@ -0,0 +1,40 @@
+'use strict';
+var styles = module.exports;
+
+var codes = {
+	reset: [0, 0],
+
+	bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
+	dim: [2, 22],
+	italic: [3, 23],
+	underline: [4, 24],
+	inverse: [7, 27],
+	hidden: [8, 28],
+	strikethrough: [9, 29],
+
+	black: [30, 39],
+	red: [31, 39],
+	green: [32, 39],
+	yellow: [33, 39],
+	blue: [34, 39],
+	magenta: [35, 39],
+	cyan: [36, 39],
+	white: [37, 39],
+	gray: [90, 39],
+
+	bgBlack: [40, 49],
+	bgRed: [41, 49],
+	bgGreen: [42, 49],
+	bgYellow: [43, 49],
+	bgBlue: [44, 49],
+	bgMagenta: [45, 49],
+	bgCyan: [46, 49],
+	bgWhite: [47, 49]
+};
+
+Object.keys(codes).forEach(function (key) {
+	var val = codes[key];
+	var style = styles[key] = {};
+	style.open = '\u001b[' + val[0] + 'm';
+	style.close = '\u001b[' + val[1] + 'm';
+});
diff --git a/license b/license
new file mode 100644
index 0000000..654d0bf
--- /dev/null
+++ b/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus at 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.
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..a9ba607
--- /dev/null
+++ b/package.json
@@ -0,0 +1,46 @@
+{
+  "name": "ansi-styles",
+  "version": "1.1.0",
+  "description": "ANSI escape codes for styling strings in the terminal",
+  "license": "MIT",
+  "repository": "sindresorhus/ansi-styles",
+  "author": {
+    "name": "Sindre Sorhus",
+    "email": "sindresorhus at gmail.com",
+    "url": "http://sindresorhus.com"
+  },
+  "engines": {
+    "node": ">=0.10.0"
+  },
+  "scripts": {
+    "test": "mocha"
+  },
+  "files": [
+    "index.js"
+  ],
+  "keywords": [
+    "ansi",
+    "styles",
+    "color",
+    "colour",
+    "colors",
+    "terminal",
+    "console",
+    "cli",
+    "string",
+    "tty",
+    "escape",
+    "formatting",
+    "rgb",
+    "256",
+    "shell",
+    "xterm",
+    "log",
+    "logging",
+    "command-line",
+    "text"
+  ],
+  "devDependencies": {
+    "mocha": "*"
+  }
+}
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..73584cc
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,70 @@
+# ansi-styles [![Build Status](https://travis-ci.org/sindresorhus/ansi-styles.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-styles)
+
+> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
+
+You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings.
+
+![screenshot](screenshot.png)
+
+
+## Install
+
+```sh
+$ npm install --save ansi-styles
+```
+
+
+## Usage
+
+```js
+var ansi = require('ansi-styles');
+
+console.log(ansi.green.open + 'Hello world!' + ansi.green.close);
+```
+
+
+## API
+
+Each style has an `open` and `close` property.
+
+
+## Styles
+
+### General
+
+- `reset`
+- `bold`
+- `dim`
+- `italic` *(not widely supported)*
+- `underline`
+- `inverse`
+- `hidden`
+- `strikethrough` *(not widely supported)*
+
+### Text colors
+
+- `black`
+- `red`
+- `green`
+- `yellow`
+- `blue`
+- `magenta`
+- `cyan`
+- `white`
+- `gray`
+
+### Background colors
+
+- `bgBlack`
+- `bgRed`
+- `bgGreen`
+- `bgYellow`
+- `bgBlue`
+- `bgMagenta`
+- `bgCyan`
+- `bgWhite`
+
+
+## License
+
+MIT © [Sindre Sorhus](http://sindresorhus.com)
diff --git a/screenshot.png b/screenshot.png
new file mode 100644
index 0000000..ec618af
Binary files /dev/null and b/screenshot.png differ
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..f030ca7
--- /dev/null
+++ b/test.js
@@ -0,0 +1,26 @@
+'use strict';
+var assert = require('assert');
+var ansi = require('./');
+
+// generates the screenshot
+Object.keys(ansi).forEach(function (el) {
+	var style = ansi[el].open;
+
+	if (el === 'reset' || el === 'hidden') {
+		return;
+	}
+
+	if (/^bg[^B]/.test(el)) {
+		style = ansi.black.open + style;
+	}
+
+	process.stdout.write(style + el + ansi.reset.open + ansi.reset.close + ' ');
+});
+
+describe('ansiStyles()', function () {
+	it('should return ANSI escape codes', function () {
+		assert.equal(ansi.green.open, '\x1b[32m');
+		assert.equal(ansi.bgGreen.open, '\x1b[42m');
+		assert.equal(ansi.green.close, '\x1b[39m');
+	});
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-ansi-styles.git



More information about the Pkg-javascript-commits mailing list