Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ansi-rainbow

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-rainbow - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

28

index.js

@@ -32,3 +32,3 @@ var ansi = require('ansi-styles')

this.options = {color_space: false, gap: 1}
this.options = {color_space: false, gap: 1, space_color: null}

@@ -135,8 +135,2 @@ var self = this

},
isSpace: function(c) {
return c == ' ' || c.match('\s')
},
isNewLine: function(c) {
return c == '\n'
},
nextColor: function(s, colors) {

@@ -174,15 +168,27 @@

},
colorSpace: function(s, color) {
if(!this.allowed(color))
throw new Error('Color '+ colors[l] +' is not recognized')
return ansi[color].open + s + ansi[color].close
},
output: function(input, colors) {
var l = input.length, output = '', i = 0, gap = this.options.gap, s
this._current_gap = 1
this._current_gap = gap
for (i; i < l; i++) {
this._current_gap = this._current_gap > gap ? 1 : this._current_gap
this._current_gap = this._current_gap > gap ? gap : this._current_gap
s = input.charAt(i)
if(!this.options.color_space && this.isSpace(s) || this.isNewLine(s)) {
if(s == '\n') {
output += s
} else if(s == ' ' && !this.options.color_space) {
output += s
} else {
output += this._current_gap == gap ? this.nextColor(s, colors) : this.currentColor(s, colors)
if(s == ' ' && this.options.space_color != null)
output += this.colorSpace(s, this.options.space_color)
else
output += this._current_gap == gap ? this.nextColor(s, colors) : this.currentColor(s, colors)
}

@@ -189,0 +195,0 @@ }

{
"name": "ansi-rainbow",
"version": "0.0.6",
"version": "0.0.7",
"description": "Ainsi rainbowify",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,3 +5,3 @@ ansi-rainbow

Rainbowify string with https://github.com/sindresorhus/ansi-styles
![rainicorn](http://www.zupmage.eu/i/W8xC5EsoJb.jpg)
# Install

@@ -8,0 +8,0 @@

@@ -1,55 +0,10 @@

▓▓▓
▓▓▓▒▒▒▓
▓▓▒▒▒▒▒▒▒▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▒▒▓▓▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▒▒▒▓▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓
▓▓▒▒▒▓▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓
▓▓▒▒▒▒▓▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓ ▓▓
▓▓▒▒▒▒▓▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓
▓▓▒▒▒▒▓▒▒▒▒▒▒▒▒▒▓░░░░░░▓▓▓▓▒▒▒▓▓▓▓▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓
▓▒▒▒▒▒▓▒▒▒▒▒▒▒▒▒▓░░░░░░░░░▓▓▓▓▒▒▒▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓
▓▒▒▒▒▒▓▒▒▒▒▒▒▒▒▒▓▓░░░░░░░░░▓▓▓▓▓▒▒▒▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓
▓▒▒▒▒▒▓▒▒▒▒▒▒▒▒▒▒▒▓░░░░░░░░░░▓▓▓▓▓▒▒▒▓▓▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓
▓▒▒▒▒▒▓▒▒▒▒▒▒▒▒▒▒▒▒▓░░░░░▒░░░░░▓▓▓▓▓▒▒▓▓▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓
▓▓▒▒▒▒▒▓▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓░░░▒░░░░░▓▓▓▓▓▒▒▒▓▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓
▓▒▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓░░░▒░░░░░░▓▓▓▓▒▒▒▓▒▒▒▒▒▒▒▒▒▒▒▒▓▓
▓▒▒▓▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒▒▒▒▓░░▒▒░░░░░░▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▒▓
▓▒▒▒▓▒▒▒▒▒▄▒▒▒█▄▀▀▀▀▀▄▄▒▒▒▒▒▒▓▒▒▒░░░░░░░▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▓ ▓▒▓
▓▒▒▒▒▓▒▒▒▒▒▀▄▄▀ ▀▄▒▒▒▒▓▒▒▒░░▓░░░░░▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▓ ▓▒▓
▓▒▒▒▒▓▒▒▒▒▄▒▄▀ █▒▒▒▓▓▒▒░▓▒▓░░░░░▓▓▓▒▒▒▒▒▒▒▒▒▒▒▓ ▓▒▓
▓▒▒▒▓▓▒▒▒▒▒██ ▓▓▓▓▓▓▓▓▒▒▒▓▓▒▒▓▒▒▓░░░░░▓▓▓▒▒▒▒▒▒▒▒▒▒▓ ▓▒▓
▓▒▒▒▓▓▓▒▒▒▒▒█ ▓▓▓▓▓▓▓▓▓▓▒▒▒▓▓▒▓▒▒▒▓░░░░░▓▓▓▒▒▒▒▒▒▒▒▒▒▓ ▓▒▓
▓▒▒▓▓▓▓▓▒▒▒▒▒ ▓▓▓▓▓ █▒▒▒▒▓▒▓▒▒▒▒▓░░░░░▓▓▓▒▒▒▒▒▒▒▒▒▓ ▓
▓▒▓▓▓▓▓▓▒▒▒▒▒ ▓▓▓▓▓ ▄█▒▒▒▒▒▓▒▒▒▒▒▓░░░░░▓▓▓▒▒▒▒▒▒▒▒▒▓
▓▓▓▓▓▓▓▓▒▒▒▒▒ ▓▓▓▓▓ ▄███▒▒▒▒▒▒▒▒▒▒▒▓░░░░░░▓▓▒▒▒▒▒▒▒▒▓
▓▓▓▓▓▓▓▓▒▒▒▒▒ ▓▓▓▓██▄▄▄████▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓░░░░░▓▓▒▒▒▒▒▒▒▓
▓▓▓▓▓▓▓▓▓▒▒▒▒▒ ▓▓▓▓████ ██▒▒▒▒▒▒▒▒▒▓▓▓ ▓░░░░░▓▓▒▒▒▒▒▒▓
▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒ ▓▓▓▓████▄▄██▒▒▒▒▒▒▒▒▓▓▓ ██▓░░░░░░▓▒▒▒▒▒▒▓
▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒ ▓▓▓▓███████▒▒▒▒▒▒▒▒▓▓▓ ▄███ ▓▓░░░░░▓▒▒▒▒▒▓
▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒ ▓▓▓▓█████▒▒▒▒▒▒▒▒▒▓▓ █▀▀██ ▓▓░░░░▒▒▒▒▒▓
▓▓▓▓▓▓▓▓▓▒▓▒▒▒▒▒▒▒ ▓▓▓▓▓███▒▒▒▒▒▒▒▒▒▒▓▓█▄▄█ ▓▓▓░▒▒▒▒▒▓
▓▓▓▓▓▓▓▓▓▒▒▓▒▒▒▒▒▒▒▒▒▒▓▓▓▒▒▒▒▒▒▒▒▒▒▓▒▒▓███ ▓▓▓▒▒▒▒▓
▓▓▓▓▓▓▓▓▒▒▒▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▒▒██ ▓▓▓▒▓
▓▓▓▓▓▓▓▒▒▒▒▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓ ▓▓
▓▓▓▓▓▓▓▒▒▒▒▒▒▓▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▒▒▒▒▒▓
▓▓▓▓▓▓▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▒▒▒▒░▓▓▓▒▒▒▒▒▒▒▒▒▒▓
▓▓▓▓▓▒▒▒▒▒▒▒▒▒▓▓▓▒▒▒▒▒▒▒░░▓▓▓▓▓▒▒▒▒▓▓▓
▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▒▒▒▒░░░▓▓▓▓
▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▓░▓▓▒▒▒░░░▓
▓▓▒▒▒▒▒▒▒▒▒▒▒▒▓░░▓▓▓▓▒▒▓▓
▓▒▒▒▒▒▒▒▒▒▒▒▓░░░▒▒▓▓▓▒▓▓
▓▒▒▒▒▒▒▒▒▒▒▓░░░▒▒▓▒▒▒▓▓▓
▓▒▒▒▒▒▒▒▒▓░░░▒▒▒▓▒▒▒▓▓▓▓
▓▒▒▒▒▒▒▒▓░░▒▒▒▒▓▒▒▒▓▓▓▓
▓▒▒▒▒▒▒▓░░▒▒▒▒▓▒▒▒▓▓▓▓▓
▓▒▒▒▒▓░░▒▒▒▓▓▒▒▒▓▓▓▓▓▓
▓▒▒▒▓░░▒▒▒▓▓▒▒▒▓▓▓▓▓▓
▓▒▓░░▒▒▒▓▒▒▒▓▓▓▓▓▓▓
▓▓░▒▒▓ ▓▒▒▒▓▓▓▓▓▓
▓░░▒▓ ▓▒▒▒▓▓▓▓▓▓
▓░▒▓ ▓▒▒▓▓▓▓▓▓
▓▒▓ ▓▒▓▓▓▓▓
▓▓ ▓▓▓▓▓▓
▓▓▓▓▓
▓▓▓
▓▓
_______ _______ _
( ____ )( ___ )( ( /||\ /|
| ( )|| ( ) || \ ( |( \ / )
| (____)|| | | || \ | | \ (_) /
| _____)| | | || (\ \) | \ /
| ( | | | || | \ | ) (
| ) | (___) || ) \ | | |
|/ (_______)|/ )_) \_/

@@ -47,3 +47,3 @@ var rainbow = require('../'), expect = require('chai').expect, colors, chalk = require('chalk')

it('should skip background colors order', function() {
it('should keep background colors order', function() {
rainbow.skip(rainbow._backgrounds).add('bgGreen bgYellow bgRed')

@@ -73,2 +73,9 @@ console.log(chalk.bold.black(rainbow.bg('Chuck norris is born in the pony world')))

it('should color spaces with a blue bg', function() {
rainbow.reset().options({gap: 1, color_space: true, space_color: 'bgBlue'}).skip('bgBlue')
console.log(rainbow.bg('text with some space'))
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc