[Pkg-javascript-commits] [node-tinycolor] 01/09: Imported Upstream version 0.0.1~aca92ed
Mike Gabriel
sunweaver at debian.org
Thu Dec 15 10:29:30 UTC 2016
This is an automated email from the git hooks/post-receive script.
sunweaver pushed a commit to branch master
in repository node-tinycolor.
commit 5a5a57db46cc10aa7f17d295e74430e249efbf1d
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Thu Jul 25 07:38:48 2013 +0200
Imported Upstream version 0.0.1~aca92ed
---
.gitignore | 5 +++++
README.md | 17 +++++++++++++++++
example.js | 3 +++
package.json | 16 ++++++++++++++++
tinycolor.js | 36 ++++++++++++++++++++++++++++++++++++
5 files changed, 77 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6bfffbb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+npm-debug.log
+node_modules
+.*.swp
+.lock-*
+build/
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2abc86d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,17 @@
+# tinycolor
+
+This is a no-fuzz, barebone, zero muppetry color module for node.js.
+
+# Environment variables
+
+* The module respects the `NOCOLOR` environment variable if you wish to disable the coloring.
+
+# License
+
+MIT License
+Copyright (c) 2012 Einar Otto Stangvik All Rights Reserved.
+
+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/example.js b/example.js
new file mode 100644
index 0000000..f754046
--- /dev/null
+++ b/example.js
@@ -0,0 +1,3 @@
+require('./tinycolor');
+console.log('this should be red and have an underline!'.grey.underline);
+console.log('this should have a blue background!'.bgBlue);
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..33a7505
--- /dev/null
+++ b/package.json
@@ -0,0 +1,16 @@
+{
+ "author": "Einar Otto Stangvik <einaros at gmail.com> (http://2x.io)",
+ "name": "tinycolor",
+ "description": "a to-the-point color module for node",
+ "version": "0.0.1",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/einaros/tinycolor.git"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "main": "tinycolor"
+}
diff --git a/tinycolor.js b/tinycolor.js
new file mode 100644
index 0000000..af412db
--- /dev/null
+++ b/tinycolor.js
@@ -0,0 +1,36 @@
+var tty = require('tty');
+
+var styles = {
+ 'bold': ['\033[1m', '\033[22m'],
+ 'italic': ['\033[3m', '\033[23m'],
+ 'underline': ['\033[4m', '\033[24m'],
+ 'inverse': ['\033[7m', '\033[27m'],
+ 'black': ['\033[30m', '\033[39m'],
+ 'red': ['\033[31m', '\033[39m'],
+ 'green': ['\033[32m', '\033[39m'],
+ 'yellow': ['\033[33m', '\033[39m'],
+ 'blue': ['\033[34m', '\033[39m'],
+ 'magenta': ['\033[35m', '\033[39m'],
+ 'cyan': ['\033[36m', '\033[39m'],
+ 'white': ['\033[37m', '\033[39m'],
+ 'default': ['\033[39m', '\033[39m'],
+ 'grey': ['\033[90m', '\033[39m'],
+ 'bgBlack': ['\033[40m', '\033[49m'],
+ 'bgRed': ['\033[41m', '\033[49m'],
+ 'bgGreen': ['\033[42m', '\033[49m'],
+ 'bgYellow': ['\033[43m', '\033[49m'],
+ 'bgBlue': ['\033[44m', '\033[49m'],
+ 'bgMagenta': ['\033[45m', '\033[49m'],
+ 'bgCyan': ['\033[46m', '\033[49m'],
+ 'bgWhite': ['\033[47m', '\033[49m'],
+ 'bgDefault': ['\033[49m', '\033[49m']
+}
+
+var enabled = !process.env.NOCOLOR && tty.isatty(1) && tty.isatty(2);
+
+Object.keys(styles).forEach(function(style) {
+ Object.defineProperty(String.prototype, style, {
+ get: function() { return (enabled ? styles[style][0] + this + styles[style][1] : this); },
+ enumerable: false
+ });
+});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-tinycolor.git
More information about the Pkg-javascript-commits
mailing list