[Pkg-javascript-commits] [node-ansi-font] 01/05: Import Upstream version 0.0.2

Sruthi Chandran srud-guest at moszumanska.debian.org
Fri Oct 14 06:11:46 UTC 2016


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

srud-guest pushed a commit to branch master
in repository node-ansi-font.

commit 5554d6563f1bb59a264f1d7d4abed1cd6d4db167
Author: Sruthi <srud at disroot.org>
Date:   Fri Oct 14 10:43:17 2016 +0530

    Import Upstream version 0.0.2
---
 History.md   |  5 +++++
 Readme.md    | 11 ++++++++++
 index.js     | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 package.json | 25 ++++++++++++++++++++++
 4 files changed, 110 insertions(+)

diff --git a/History.md b/History.md
new file mode 100644
index 0000000..b29c85a
--- /dev/null
+++ b/History.md
@@ -0,0 +1,5 @@
+# Changes #
+
+## 0.0.1 / 2011-07-10 ##
+
+  - Initial release
\ No newline at end of file
diff --git a/Readme.md b/Readme.md
new file mode 100644
index 0000000..0deb1eb
--- /dev/null
+++ b/Readme.md
@@ -0,0 +1,11 @@
+# ansi-font #
+
+ANSI font styling utils
+
+## Install ##
+
+    npm install ansi-font
+
+## Require ##
+
+    var font = require('!raw.github.com/Gozala/ansi-font/v0.0.1/index')
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..53366e2
--- /dev/null
+++ b/index.js
@@ -0,0 +1,69 @@
+/* vim:set ts=2 sw=2 sts=2 expandtab */
+/*jshint asi: true newcap: true undef: true es5: true node: true devel: true
+         forin: false */
+/*global define: true */
+
+(typeof define === "undefined" ? function ($) { $(require, exports, module) } : define)(function (require, exports, module, undefined) {
+
+"use strict";
+
+var ESC = '\u001b['
+
+// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
+var SGR_STYLES = {
+  bold:           [ 1,  22 ],
+  italic:         [ 3,  23 ],
+  underline:      [ 4,  24 ],
+  blink:          [ 5,  25 ],
+
+  inverse:        [ 7,  27 ],
+
+  frame:         [ 51, 54 ],
+  encircle:      [ 52, 54 ],
+
+  overline:       [ 53, 55 ],
+  strikethrough:  [ 53, 55 ]
+}
+var SGR_COLORS = {}
+var SGR_BACKROUNDS = {}
+var COLORS = [
+  'black',
+  'red',
+  'green',
+  'yellow',
+  'blue',
+  'magenta',
+  'cyan',
+  'white'
+]
+
+COLORS.forEach(function(color, index) {
+  SGR_COLORS[color] = [ 30 + index, 39 ]
+  SGR_BACKROUNDS[color] = [ 40 + index, 49 ]
+})
+
+function sgr(options, id, message) {
+  var params = options[id]
+  if (params) message = ESC + params[0] + 'm' + message + ESC + params[1] + 'm'
+  return message
+}
+
+exports.style = sgr.bind(null, SGR_STYLES)
+exports.color = sgr.bind(null, SGR_COLORS)
+exports.background = sgr.bind(null, SGR_BACKROUNDS)
+
+Object.keys(SGR_STYLES).forEach(function(name) {
+  exports[name] = exports.style.bind(null, name)
+})
+Object.keys(SGR_COLORS).forEach(function(name) {
+  exports[name] = exports.color.bind(null, name)
+  exports['bg' + name] = exports.background.bind(null, name)
+})
+
+var index = 0
+while(index++ < 256) {
+  SGR_COLORS[index] = ['38;5;' + index, 39]
+  SGR_BACKROUNDS[index] = ['48;5;' + index, 39]
+}
+
+});
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..da2ff07
--- /dev/null
+++ b/package.json
@@ -0,0 +1,25 @@
+{
+  "name": "ansi-font",
+  "id": "ansi-font",
+  "version": "0.0.2",
+  "description": "ANSI font styling utils",
+  "keywords": [ "ANSI", "font", "style", "colors" ],
+  "author": "Irakli Gozalishvili <rfobic at gmail.com> (http://jeditoolkit.com)",
+  "homepage": "https://github.com/Gozala/ansi-font",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/Gozala/ansi-font.git",
+    "web": "https://github.com/Gozala/ansi-font"
+  },
+  "bugs": {
+    "url": "http://github.com/Gozala/ansi-font/issues/"
+  },
+  "main": "./index.js",
+  "engines": {
+    "node": ">=0.4.x"
+  },
+  "licenses": [{
+    "type" : "MIT",
+    "url" : "http://jeditoolkit.com/LICENSE"
+  }]
+}

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



More information about the Pkg-javascript-commits mailing list