@visulima/colorize 2.0.0-alpha.1 → 2.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +169 -0
- package/LICENSE.md +1 -1
- package/README.md +32 -30
- package/dist/gradient.cjs +3 -60
- package/dist/gradient.d.cts +21 -12
- package/dist/gradient.d.mts +21 -12
- package/dist/gradient.d.ts +21 -12
- package/dist/gradient.mjs +3 -54
- package/dist/index.browser.d.mts +204 -61
- package/dist/index.browser.d.ts +204 -0
- package/dist/index.browser.mjs +1 -61
- package/dist/index.server.cjs +2 -246
- package/dist/index.server.d.cts +13 -7
- package/dist/index.server.d.mts +204 -61
- package/dist/index.server.d.ts +13 -7
- package/dist/index.server.mjs +1 -61
- package/dist/packem_shared/Colorize-BUAQi0t0.js +2 -0
- package/dist/packem_shared/Colorize-i0NybjSp.js +1 -0
- package/dist/packem_shared/GradientBuilder-CudosKb8.cjs +1 -0
- package/dist/packem_shared/GradientBuilder-Du8WSL23.mjs +1 -0
- package/dist/packem_shared/colorize.server-BkQZGeaS.mjs +2 -0
- package/dist/packem_shared/colorize.server-Dn-gV0MN.cjs +2 -0
- package/dist/packem_shared/convertHexToRgb-CJNE3k_E.mjs +1 -0
- package/dist/packem_shared/convertHexToRgb-Dvalc5FD.cjs +1 -0
- package/dist/packem_shared/rgbToAnsi256--f09kvlF.cjs +1 -0
- package/dist/packem_shared/rgbToAnsi256-YETEPW8R.mjs +1 -0
- package/dist/packem_shared/types.d-bhP-2hCu.d.cts +154 -0
- package/dist/packem_shared/types.d-bhP-2hCu.d.mts +154 -0
- package/dist/packem_shared/types.d-bhP-2hCu.d.ts +154 -0
- package/dist/template.cjs +2 -144
- package/dist/template.d.cts +10 -4
- package/dist/template.d.mts +4 -4
- package/dist/template.d.ts +10 -4
- package/dist/template.mjs +2 -138
- package/dist/utils.cjs +1 -13
- package/dist/utils.d.cts +13 -2
- package/dist/utils.d.mts +13 -2
- package/dist/utils.d.ts +13 -2
- package/dist/utils.mjs +1 -2
- package/package.json +50 -50
- package/dist/ansi-codes.d.cts +0 -18
- package/dist/ansi-codes.d.mts +0 -18
- package/dist/ansi-codes.d.ts +0 -18
- package/dist/colorize.browser.d.mts +0 -3
- package/dist/colorize.server.d.cts +0 -10
- package/dist/colorize.server.d.mts +0 -10
- package/dist/colorize.server.d.ts +0 -10
- package/dist/css-code.d.mts +0 -11
- package/dist/gradient/gradient-builder.d.cts +0 -10
- package/dist/gradient/gradient-builder.d.mts +0 -10
- package/dist/gradient/gradient-builder.d.ts +0 -10
- package/dist/gradient/util/color-names.d.cts +0 -2
- package/dist/gradient/util/color-names.d.mts +0 -2
- package/dist/gradient/util/color-names.d.ts +0 -2
- package/dist/gradient/util/compute.d.cts +0 -2
- package/dist/gradient/util/compute.d.mts +0 -2
- package/dist/gradient/util/compute.d.ts +0 -2
- package/dist/gradient/util/hsv-to-rgb.d.cts +0 -5
- package/dist/gradient/util/hsv-to-rgb.d.mts +0 -5
- package/dist/gradient/util/hsv-to-rgb.d.ts +0 -5
- package/dist/gradient/util/interpolate.d.cts +0 -3
- package/dist/gradient/util/interpolate.d.mts +0 -3
- package/dist/gradient/util/interpolate.d.ts +0 -3
- package/dist/gradient/util/rgb-to-hsv.d.cts +0 -9
- package/dist/gradient/util/rgb-to-hsv.d.mts +0 -9
- package/dist/gradient/util/rgb-to-hsv.d.ts +0 -9
- package/dist/packem_shared/Colorize-BenP3bFn.mjs +0 -241
- package/dist/packem_shared/Colorize-Ca9CXTcj.mjs +0 -413
- package/dist/packem_shared/GradientBuilder-BXOgJeHi.cjs +0 -490
- package/dist/packem_shared/GradientBuilder-DTnSGyYW.mjs +0 -486
- package/dist/packem_shared/colorize.server-BA3gZZXz.cjs +0 -193
- package/dist/packem_shared/colorize.server-ry9FZNfG.mjs +0 -191
- package/dist/packem_shared/convertHexToRgb-CWdAm2kE.mjs +0 -13
- package/dist/packem_shared/convertHexToRgb-DvkHBM3-.cjs +0 -17
- package/dist/packem_shared/rgbToAnsi256-BdS0fomP.mjs +0 -41
- package/dist/packem_shared/rgbToAnsi256-DL8eajTz.cjs +0 -47
- package/dist/template/make-colorize-template.d.cts +0 -9
- package/dist/template/make-colorize-template.d.mts +0 -9
- package/dist/template/make-colorize-template.d.ts +0 -9
- package/dist/template/make-template.d.cts +0 -10
- package/dist/template/make-template.d.mts +0 -10
- package/dist/template/make-template.d.ts +0 -10
- package/dist/types.d.cts +0 -174
- package/dist/types.d.mts +0 -174
- package/dist/types.d.ts +0 -174
- package/dist/util/ansi-code-hex-map.d.mts +0 -8
- package/dist/util/clamp.d.cts +0 -12
- package/dist/util/clamp.d.mts +0 -12
- package/dist/util/clamp.d.ts +0 -12
- package/dist/util/convert-hex-to-rgb.d.cts +0 -22
- package/dist/util/convert-hex-to-rgb.d.mts +0 -22
- package/dist/util/convert-hex-to-rgb.d.ts +0 -22
- package/dist/util/convert-rgb-to-ansi.d.cts +0 -18
- package/dist/util/convert-rgb-to-ansi.d.mts +0 -18
- package/dist/util/convert-rgb-to-ansi.d.ts +0 -18
- package/dist/util/string-replace-all.d.cts +0 -12
- package/dist/util/string-replace-all.d.mts +0 -12
- package/dist/util/string-replace-all.d.ts +0 -12
- package/dist/util/unescape.d.cts +0 -9
- package/dist/util/unescape.d.mts +0 -9
- package/dist/util/unescape.d.ts +0 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var S=Object.defineProperty;var i=(f,o)=>S(f,"name",{value:o,configurable:!0});const h={0:"#000",1:"#800",2:"#080",3:"#880",4:"#008",5:"#808",6:"#088",7:"#ccc",8:"#444",9:"#f00",10:"#0f0",11:"#ff0",12:"#00f",13:"#f0f",14:"#0ff",15:"#fff",16:"#000",17:"#00005f",18:"#000087",19:"#0000af",20:"#0000d7",21:"#0000ff",22:"#005f00",23:"#005f5f",24:"#005f87",25:"#005faf",26:"#005fd7",27:"#005fff",28:"#008700",29:"#00875f",30:"#008787",31:"#0087af",32:"#0087d7",33:"#0087ff",34:"#00af00",35:"#00af5f",36:"#00af87",37:"#00afaf",38:"#00afd7",39:"#00afff",40:"#00d700",41:"#00d75f",42:"#00d787",43:"#00d7af",44:"#00d7d7",45:"#00d7ff",46:"#00ff00",47:"#00ff5f",48:"#00ff87",49:"#00ffaf",50:"#00ffd7",51:"#00ffff",52:"#5f0000",53:"#5f005f",54:"#5f0087",55:"#5f00af",56:"#5f00d7",57:"#5f00ff",58:"#5f5f00",59:"#5f5f5f",60:"#5f5f87",61:"#5f5faf",62:"#5f5fd7",63:"#5f5fff",64:"#5f8700",65:"#5f875f",66:"#5f8787",67:"#5f87af",68:"#5f87d7",69:"#5f87ff",70:"#5faf00",71:"#5faf5f",72:"#5faf87",73:"#5fafaf",74:"#5fafd7",75:"#5fafff",76:"#5fd700",77:"#5fd75f",78:"#5fd787",79:"#5fd7af",80:"#5fd7d7",81:"#5fd7ff",82:"#5fff00",83:"#5fff5f",84:"#5fff87",85:"#5fffaf",86:"#5fffd7",87:"#5fffff",88:"#870000",89:"#87005f",90:"#870087",91:"#8700af",92:"#8700d7",93:"#8700ff",94:"#875f00",95:"#875f5f",96:"#875f87",97:"#875faf",98:"#875fd7",99:"#875fff",100:"#878700",101:"#87875f",102:"#878787",103:"#8787af",104:"#8787d7",105:"#8787ff",106:"#87af00",107:"#87af5f",108:"#87af87",109:"#87afaf",110:"#87afd7",111:"#87afff",112:"#87d700",113:"#87d75f",114:"#87d787",115:"#87d7af",116:"#87d7d7",117:"#87d7ff",118:"#87ff00",119:"#87ff5f",120:"#87ff87",121:"#87ffaf",122:"#87ffd7",123:"#87ffff",124:"#af0000",125:"#af005f",126:"#af0087",127:"#af00af",128:"#af00d7",129:"#af00ff",130:"#af5f00",131:"#af5f5f",132:"#af5f87",133:"#af5faf",134:"#af5fd7",135:"#af5fff",136:"#af8700",137:"#af875f",138:"#af8787",139:"#af87af",140:"#af87d7",141:"#af87ff",142:"#afaf00",143:"#afaf5f",144:"#afaf87",145:"#afafaf",146:"#afafd7",147:"#afafff",148:"#afd700",149:"#afd75f",150:"#afd787",151:"#afd7af",152:"#afd7d7",153:"#afd7ff",154:"#afff00",155:"#afff5f",156:"#afff87",157:"#afffaf",158:"#afffd7",159:"#afffff",160:"#d70000",161:"#d7005f",162:"#d70087",163:"#d700af",164:"#d700d7",165:"#d700ff",166:"#d75f00",167:"#d75f5f",168:"#d75f87",169:"#d75faf",170:"#d75fd7",171:"#d75fff",172:"#d78700",173:"#d7875f",174:"#d78787",175:"#d787af",176:"#d787d7",177:"#d787ff",178:"#d7af00",179:"#d7af5f",180:"#d7af87",181:"#d7afaf",182:"#d7afd7",183:"#d7afff",184:"#d7d700",185:"#d7d75f",186:"#d7d787",187:"#d7d7af",188:"#d7d7d7",189:"#d7d7ff",190:"#d7ff00",191:"#d7ff5f",192:"#d7ff87",193:"#d7ffaf",194:"#d7ffd7",195:"#d7ffff",196:"#ff0000",197:"#ff005f",198:"#ff0087",199:"#ff00af",200:"#ff00d7",201:"#ff00ff",202:"#ff5f00",203:"#ff5f5f",204:"#ff5f87",205:"#ff5faf",206:"#ff5fd7",207:"#ff5fff",208:"#ff8700",209:"#ff875f",210:"#ff8787",211:"#ff87af",212:"#ff87d7",213:"#ff87ff",214:"#ffaf00",215:"#ffaf5f",216:"#ffaf87",217:"#ffafaf",218:"#ffafd7",219:"#ffafff",220:"#ffd700",221:"#ffd75f",222:"#ffd787",223:"#ffd7af",224:"#ffd7d7",225:"#ffd7ff",226:"#ffff00",227:"#ffff5f",228:"#ffff87",229:"#ffffaf",230:"#ffffd7",231:"#ffffff",232:"#080808",233:"#121212",234:"#1c1c1c",235:"#262626",236:"#303030",237:"#3a3a3a",238:"#444444",239:"#4e4e4e",240:"#585858",241:"#626262",242:"#6c6c6c",243:"#767676",244:"#808080",245:"#8a8a8a",246:"#949494",247:"#9e9e9e",248:"#a8a8a8",249:"#b2b2b2",250:"#bcbcbc",251:"#c6c6c6",252:"#d0d0d0",253:"#dadada",254:"#e4e4e4",255:"#eeeeee"};var $=Object.defineProperty,t=i((f,o)=>$(f,"name",{value:o,configurable:!0}),"r");const k={bold:"font-weight: bold;",dim:"opacity: 0.5;",hidden:"visibility: hidden;",inverse:"background-color: currentColor; color: background-color;",italic:"font-style: italic;",overline:"text-decoration: overline;",reset:"color: inherit",strike:"text-decoration: line-through;",strikethrough:"text-decoration: line-through;",underline:"text-decoration: underline;",visible:"opacity: 0;"},y={bgBlack:"background-color: black; color: white;",bgBlackBright:"background-color: #666; color: white;",bgBlue:"background-color: blue; color: white;",bgBlueBright:"background-color: #55f; color: white;",bgCyan:"background-color: cyan; color: black;",bgCyanBright:"background-color: #5ff; color: black;",bgGray:"background-color: #666; color: white;",bgGreen:"background-color: green; color: white;",bgGreenBright:"background-color: #5f5; color: white;",bgGrey:"background-color: #666; color: white;",bgMagenta:"background-color: magenta; color: white;",bgMagentaBright:"background-color: #f5f; color: white;",bgRed:"background-color: red; color: white;",bgRedBright:"background-color: #f55; color: white;",bgWhite:"background-color: white; color: black;",bgWhiteBright:"background-color: #eee; color: black;",bgYellow:"background-color: yellow; color: black;",bgYellowBright:"background-color: #ff5; color: black;",black:"color: black;",blackBright:"color: #666;",blue:"color: blue;",blueBright:"color: #55f;",cyan:"color: cyan;",cyanBright:"color: #5ff;",gray:"color: #666;",green:"color: green;",greenBright:"color: #5f5;",grey:"color: #666;",magenta:"color: magenta;",magentaBright:"color: #f5f;",red:"color: red;",redBright:"color: #f55;",white:"color: white;",whiteBright:"color: #eee;",yellow:"color: yellow;",yellowBright:"color: #ff5;"},p={bg:t(f=>`background-color: ${h[f]??""};`,"bg"),bgHex:t(f=>`background-color: ${f};`,"bgHex"),bgRgb:t((f,o,r)=>`background-color: rgb(${String(f)},${String(o)},${String(r)});`,"bgRgb"),fg:t(f=>`color: ${h[f]??""};`,"fg"),hex:t(f=>`color:${f};`,"hex"),rgb:t((f,o,r)=>`color: rgb(${String(f)},${String(o)},${String(r)});`,"rgb")};var v=Object.defineProperty,n=i((f,o)=>v(f,"name",{value:o,configurable:!0}),"c");const c={};let b=null;const w=n(f=>{const o={};return f.replace(/(?<=^|;)\s*([^:]+)\s*:\s*([^;]+)\s*/g,(r,e,a)=>(o[e]=a,a)),o},"cssStringToObject"),s=n(({props:f},o)=>{let r=o;if(f?.cssStack){const a=w(o),d=w(f.cssStack);for(const l in d)a[l]??=d[l];r=`${JSON.stringify(a).replace(/["{}]/g,"").replace(/,/g,";")};`}const e=n((a,...d)=>{if(!a)return[];if(typeof a=="string"&&a.includes("%c")){const g=a.match(/(?<=,).*;/g);return[`%c${a.replace(/,.*;/g,"")}`,e.css,...g??[]]}if(typeof a=="number"||typeof a=="string")return[`%c${String(a)}`,e.css];if(a.raw!==void 0&&Array.isArray(d)&&d.length>0){const g=String.raw(a,...d),B=g.match(/(?<=,).*;/g);return[`%c${g.replace(/,.*;/g,"")}`,e.css,...(B??[]).join("").split(",").filter(Boolean)]}const[l,...u]=a;return u.unshift(e.css),[`${String(l).includes("%c")?"":"%c"}${String(l)}`,u.join("")]},"style");return Object.setPrototypeOf(e,b),e.props={css:o,cssStack:r,props:f},e.css=r,e},"createStyle"),O=n(function(){const f=n(o=>String(o),"self");f.strip=o=>o;for(const o in y)c[o]={get(){const r=s(this,y[o]);return Object.defineProperty(this,o,{value:r}),r}};for(const o in k)c[o]={get(){const r=s(this,k[o]);return Object.defineProperty(this,o,{value:r}),r}};return b=Object.defineProperties({},c),Object.setPrototypeOf(f,b),f},"WebColorize");for(const f in p)c[f]={get(){return(...o)=>s(this,p[f](...o))}};c.ansi256=c.fg;c.bgAnsi256=c.bg;export{O as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var j=Object.defineProperty;var g=(n,r)=>j(n,"name",{value:r,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("./convertHexToRgb-Dvalc5FD.cjs"),k={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};var x=Object.defineProperty,T=g((n,r)=>x(n,"name",{value:r,configurable:!0}),"i");const M=T((n,r)=>{const i=n.length;if(r=Number.parseInt(r.toString(),10),Number.isNaN(r)||r<2)throw new Error("Invalid number of steps (< 2)");if(r<i)throw new Error("Number of steps cannot be inferior to number of stops");const t=[];for(let o=1;o<i;o+=1){const s=(r-1)*(n[o].position-n[o-1].position);t.push(Math.max(1,Math.round(s)))}let e=1;for(let o=i-2;o>=0;o-=1)e+=t[o];for(;e!==r;)if(e<r){const o=Math.min(...t),s=t.indexOf(o);t[s]=t[s]+1,e+=1}else{const o=Math.max(...t),s=t.indexOf(o);t[s]=t[s]-1,e-=1}return t},"computeSubSteps");var H=Object.defineProperty,N=g((n,r)=>H(n,"name",{value:r,configurable:!0}),"c$1");const P=N((n,r,i)=>{let t=0,e=0,o=0;const s=Math.floor(n/60),c=n/60-s,a=i*(1-r),h=i*(1-c*r),l=i*(1-(1-c)*r);return s%6===0?(t=i,e=l,o=a):s%6===1?(t=h,e=i,o=a):s%6===2?(t=a,e=i,o=l):s%6===3?(t=a,e=h,o=i):s%6===4?(t=l,e=a,o=i):s%6===5&&(t=i,e=a,o=h),{b:Math.round(o*255),g:Math.round(e*255),r:Math.round(t*255)}},"hsvToRgb");var A=Object.defineProperty,O=g((n,r)=>A(n,"name",{value:r,configurable:!0}),"b");const q=O(({b:n,g:r,r:i})=>{let t,e,o,s=0,c=0;i/=255,r/=255,n/=255;const a=Math.max(i,r,n),h=a-Math.min(i,r,n),l=O(p=>(a-p)/6/h+1/2,"diffc");return h!==0&&(c=h/a,t=l(i),e=l(r),o=l(n),a===i?s=o-e:a===r?s=.3333333333333333+t-o:a===n&&(s=.6666666666666666+e-t),s<0?s+=1:s>1&&(s-=1)),{h:s*360,s:c,v:a}},"rgbToHsv");var C=Object.defineProperty,m=g((n,r)=>C(n,"name",{value:r,configurable:!0}),"c");const I={b:256,g:256,r:256},L={h:360,s:1,v:1},R=m((n,r,i)=>{const t={};for(const e in n)Object.hasOwn(n,e)&&(t[e]=i===0?0:(r[e]-n[e])/i);return t},"calculateStepSize"),S=m((n,r,i,t)=>{const e={};for(const o in r)if(Object.hasOwn(r,o)){let s=n[o]*i+r[o];s<0?s+=t[o]:t[o]!==1&&(s%=t[o]),e[o]=s}return e},"interpolate"),v=m((n,r,i)=>{const t={b:n.color[2],g:n.color[1],r:n.color[0]},e={b:r.color[2],g:r.color[1],r:r.color[0]},o=R(t,e,i),s=[{...t}];for(let c=1;c<i;c+=1){const a=S(o,t,c,I);s.push({b:Math.floor(a.b),g:Math.floor(a.g),r:Math.floor(a.r)})}return s},"interpolateRgb"),E=m((n,r,i,t)=>{const e=q({b:n.color[2],g:n.color[1],r:n.color[0]}),o=q({b:r.color[2],g:r.color[1],r:r.color[0]});if(e.s===0||o.s===0)return v(n,r,i);let s;if(typeof t=="boolean")s=t;else{const l=e.h<o.h&&o.h-e.h<180||e.h>o.h&&e.h-o.h>180;s=t==="long"&&l||t==="short"&&!l}const c=R(e,o,i),a=[{b:n.color[2],g:n.color[1],r:n.color[0]}];let h;e.h<=o.h&&!s||e.h>=o.h&&s?h=o.h-e.h:s?h=360-o.h+e.h:h=360-e.h+o.h,c.h=(-1)**(s?1:0)*Math.abs(h)/i;for(let l=1;l<i;l+=1){const p=S(c,e,l,L);a.push(P(p.h,p.s,p.v))}return a},"interpolateHsv");var $=Object.defineProperty,z=g((n,r)=>$(n,"name",{value:r,configurable:!0}),"d");class f{static{g(this,"GradientBuilder")}static{z(this,"GradientBuilder")}#o;stops;constructor(r,i){if(this.#o=r,this.stops=[],i.length<2)throw new Error("Invalid number of stops (< 2)");const t=i[0].position!==void 0;let e=i.length,o=-1,s=!1;for(const[h,l]of i.entries()){let p;const y=l.position!==void 0;if(t!==y)throw new Error("Cannot mix positioned and non-positioned color stops");if(y){const u=l,d=u.color!==void 0;if(!d&&(s||h===0||h===e-1))throw new Error("Cannot define two consecutive position-only stops");s=!d;let b;if(d&&(Array.isArray(u.color)?b=u.color:typeof u.color=="string"?b=u.color.includes("#")?w.convertHexToRgb(u.color):k[u.color]:u.color&&"r"in u.color&&"g"in u.color&&"b"in u.color&&(b=[u.color.r,u.color.g,u.color.b])),p={color:b,colorLess:!d,position:u.position},p.position<0||p.position>1)throw new Error("Color stops positions must be between 0 and 1");if(p.position<o)throw new Error("Color stops positions are not ordered");o=p.position}else if(Array.isArray(l))p={color:l,position:h/(e-1)};else if(typeof l=="string")p={color:l.includes("#")?w.convertHexToRgb(l):k[l],position:h/(e-1)};else if(l?.r!==void 0&&l?.g!==void 0&&l?.b!==void 0)p={color:[l.r,l.g,l.b],position:h/(e-1)};else throw new Error("Invalid color stop");this.stops.push(p)}const c=this.stops[0];c.position!==0&&(this.stops.unshift({color:c.color,position:0}),e+=1);const a=this.stops[e-1];a.position!==1&&this.stops.push({color:a.color,position:1})}reverse(){const r=[];for(const i of this.stops){const t={...i,position:1-i.position};r.push(t)}return new f(this.#o,r.toReversed())}loop(){const r=[],i=[];for(const t of this.stops)r.push({color:t.color,position:(t.position||0)/2});for(const t of this.stops.slice(0,-1))i.push({color:t.color,position:1-(t.position||0)/2});return new f(this.#o,[...r,...i.toReversed()])}rgb(r){const i=M(this.stops,r),t=[];this.stops.forEach((e,o)=>{if(e.colorLess){const s=v(this.stops[o-1],this.stops[o+1],2);e.color=[s[1].r,s[1].g,s[1].b]}});for(let e=0,o=this.stops.length;e<o-1;e+=1){const s=v(this.stops[e],this.stops[e+1],i[e]);t.splice(t.length,0,...s.map(c=>this.#o.rgb(c.r,c.g,c.b)))}return t.push(this.#o.rgb(...this.stops.at(-1).color)),t}hsv(r,i=!1){const t=M(this.stops,r),e=[];this.stops.forEach((o,s)=>{if(o.colorLess){const c=E(this.stops[s-1],this.stops[s+1],2,i);o.color=[c[1].r,c[1].g,c[1].b]}});for(let o=0,s=this.stops.length;o<s-1;o+=1){const c=E(this.stops[o],this.stops[o+1],t[o],i);e.splice(e.length,0,...c.map(a=>this.#o.rgb(a.r,a.g,a.b)))}return e.push(this.#o.rgb(...this.stops.at(-1).color)),e}}exports.GradientBuilder=f;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var R=Object.defineProperty;var u=(n,e)=>R(n,"name",{value:e,configurable:!0});import{convertHexToRgb as w}from"./convertHexToRgb-CJNE3k_E.mjs";const k={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};var S=Object.defineProperty,N=u((n,e)=>S(n,"name",{value:e,configurable:!0}),"i");const M=N((n,e)=>{const i=n.length;if(e=Number.parseInt(e.toString(),10),Number.isNaN(e)||e<2)throw new Error("Invalid number of steps (< 2)");if(e<i)throw new Error("Number of steps cannot be inferior to number of stops");const t=[];for(let o=1;o<i;o+=1){const s=(e-1)*(n[o].position-n[o-1].position);t.push(Math.max(1,Math.round(s)))}let r=1;for(let o=i-2;o>=0;o-=1)r+=t[o];for(;r!==e;)if(r<e){const o=Math.min(...t),s=t.indexOf(o);t[s]=t[s]+1,r+=1}else{const o=Math.max(...t),s=t.indexOf(o);t[s]=t[s]-1,r-=1}return t},"computeSubSteps");var H=Object.defineProperty,P=u((n,e)=>H(n,"name",{value:e,configurable:!0}),"c$1");const T=P((n,e,i)=>{let t=0,r=0,o=0;const s=Math.floor(n/60),c=n/60-s,a=i*(1-e),h=i*(1-c*e),l=i*(1-(1-c)*e);return s%6===0?(t=i,r=l,o=a):s%6===1?(t=h,r=i,o=a):s%6===2?(t=a,r=i,o=l):s%6===3?(t=a,r=h,o=i):s%6===4?(t=l,r=a,o=i):s%6===5&&(t=i,r=a,o=h),{b:Math.round(o*255),g:Math.round(r*255),r:Math.round(t*255)}},"hsvToRgb");var A=Object.defineProperty,O=u((n,e)=>A(n,"name",{value:e,configurable:!0}),"b");const E=O(({b:n,g:e,r:i})=>{let t,r,o,s=0,c=0;i/=255,e/=255,n/=255;const a=Math.max(i,e,n),h=a-Math.min(i,e,n),l=O(p=>(a-p)/6/h+1/2,"diffc");return h!==0&&(c=h/a,t=l(i),r=l(e),o=l(n),a===i?s=o-r:a===e?s=.3333333333333333+t-o:a===n&&(s=.6666666666666666+r-t),s<0?s+=1:s>1&&(s-=1)),{h:s*360,s:c,v:a}},"rgbToHsv");var C=Object.defineProperty,f=u((n,e)=>C(n,"name",{value:e,configurable:!0}),"c");const I={b:256,g:256,r:256},L={h:360,s:1,v:1},j=f((n,e,i)=>{const t={};for(const r in n)Object.hasOwn(n,r)&&(t[r]=i===0?0:(e[r]-n[r])/i);return t},"calculateStepSize"),x=f((n,e,i,t)=>{const r={};for(const o in e)if(Object.hasOwn(e,o)){let s=n[o]*i+e[o];s<0?s+=t[o]:t[o]!==1&&(s%=t[o]),r[o]=s}return r},"interpolate"),m=f((n,e,i)=>{const t={b:n.color[2],g:n.color[1],r:n.color[0]},r={b:e.color[2],g:e.color[1],r:e.color[0]},o=j(t,r,i),s=[{...t}];for(let c=1;c<i;c+=1){const a=x(o,t,c,I);s.push({b:Math.floor(a.b),g:Math.floor(a.g),r:Math.floor(a.r)})}return s},"interpolateRgb"),q=f((n,e,i,t)=>{const r=E({b:n.color[2],g:n.color[1],r:n.color[0]}),o=E({b:e.color[2],g:e.color[1],r:e.color[0]});if(r.s===0||o.s===0)return m(n,e,i);let s;if(typeof t=="boolean")s=t;else{const l=r.h<o.h&&o.h-r.h<180||r.h>o.h&&r.h-o.h>180;s=t==="long"&&l||t==="short"&&!l}const c=j(r,o,i),a=[{b:n.color[2],g:n.color[1],r:n.color[0]}];let h;r.h<=o.h&&!s||r.h>=o.h&&s?h=o.h-r.h:s?h=360-o.h+r.h:h=360-r.h+o.h,c.h=(-1)**(s?1:0)*Math.abs(h)/i;for(let l=1;l<i;l+=1){const p=x(c,r,l,L);a.push(T(p.h,p.s,p.v))}return a},"interpolateHsv");var $=Object.defineProperty,z=u((n,e)=>$(n,"name",{value:e,configurable:!0}),"d");class v{static{u(this,"GradientBuilder")}static{z(this,"GradientBuilder")}#o;stops;constructor(e,i){if(this.#o=e,this.stops=[],i.length<2)throw new Error("Invalid number of stops (< 2)");const t=i[0].position!==void 0;let r=i.length,o=-1,s=!1;for(const[h,l]of i.entries()){let p;const y=l.position!==void 0;if(t!==y)throw new Error("Cannot mix positioned and non-positioned color stops");if(y){const g=l,d=g.color!==void 0;if(!d&&(s||h===0||h===r-1))throw new Error("Cannot define two consecutive position-only stops");s=!d;let b;if(d&&(Array.isArray(g.color)?b=g.color:typeof g.color=="string"?b=g.color.includes("#")?w(g.color):k[g.color]:g.color&&"r"in g.color&&"g"in g.color&&"b"in g.color&&(b=[g.color.r,g.color.g,g.color.b])),p={color:b,colorLess:!d,position:g.position},p.position<0||p.position>1)throw new Error("Color stops positions must be between 0 and 1");if(p.position<o)throw new Error("Color stops positions are not ordered");o=p.position}else if(Array.isArray(l))p={color:l,position:h/(r-1)};else if(typeof l=="string")p={color:l.includes("#")?w(l):k[l],position:h/(r-1)};else if(l?.r!==void 0&&l?.g!==void 0&&l?.b!==void 0)p={color:[l.r,l.g,l.b],position:h/(r-1)};else throw new Error("Invalid color stop");this.stops.push(p)}const c=this.stops[0];c.position!==0&&(this.stops.unshift({color:c.color,position:0}),r+=1);const a=this.stops[r-1];a.position!==1&&this.stops.push({color:a.color,position:1})}reverse(){const e=[];for(const i of this.stops){const t={...i,position:1-i.position};e.push(t)}return new v(this.#o,e.toReversed())}loop(){const e=[],i=[];for(const t of this.stops)e.push({color:t.color,position:(t.position||0)/2});for(const t of this.stops.slice(0,-1))i.push({color:t.color,position:1-(t.position||0)/2});return new v(this.#o,[...e,...i.toReversed()])}rgb(e){const i=M(this.stops,e),t=[];this.stops.forEach((r,o)=>{if(r.colorLess){const s=m(this.stops[o-1],this.stops[o+1],2);r.color=[s[1].r,s[1].g,s[1].b]}});for(let r=0,o=this.stops.length;r<o-1;r+=1){const s=m(this.stops[r],this.stops[r+1],i[r]);t.splice(t.length,0,...s.map(c=>this.#o.rgb(c.r,c.g,c.b)))}return t.push(this.#o.rgb(...this.stops.at(-1).color)),t}hsv(e,i=!1){const t=M(this.stops,e),r=[];this.stops.forEach((o,s)=>{if(o.colorLess){const c=q(this.stops[s-1],this.stops[s+1],2,i);o.color=[c[1].r,c[1].g,c[1].b]}});for(let o=0,s=this.stops.length;o<s-1;o+=1){const c=q(this.stops[o],this.stops[o+1],t[o],i);r.splice(r.length,0,...c.map(a=>this.#o.rgb(a.r,a.g,a.b)))}return r.push(this.#o.rgb(...this.stops.at(-1).color)),r}}export{v as GradientBuilder};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var T=Object.defineProperty;var u=(e,r)=>T(e,"name",{value:r,configurable:!0});import{isStdoutColorSupported as G}from"@visulima/is-ansi-color-supported";import{convertHexToRgb as M}from"./convertHexToRgb-CJNE3k_E.mjs";import{rgbToAnsi256 as F,ansi256To16 as $,rgbToAnsi16 as R}from"./rgbToAnsi256-YETEPW8R.mjs";var H=Object.defineProperty,W=u((e,r)=>H(e,"name",{value:r,configurable:!0}),"e");function j({onlyFirst:e=!1}={}){const r="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(r,e?void 0:"g")}u(j,"t$1");W(j,"ansiRegex");var Y=Object.defineProperty,q=u((e,r)=>Y(e,"name",{value:r,configurable:!0}),"n$1");const s=q((e,r,n)=>r>e?r:Math.min(e,n),"clamp");var z=Object.defineProperty,c=u((e,r)=>z(e,"name",{value:r,configurable:!0}),"b");const o=39,g=49,k=10,m=G(),w={close:"",open:""},t=m>0?(e,r)=>({close:`\x1B[${String(r)}m`,open:`\x1B[${String(e)}m`}):()=>w,O=c(e=>(r,n,i)=>e(F(Number(r),Number(n),Number(i))),"createRgbFunction"),x=c(e=>r=>{const[n,i,a]=M(r);return e(n,i,a)},"createHexFunction");let d=c(e=>t(`38;5;${String(e)}`,o),"createAnsi256"),S=c(e=>t(`48;5;${String(e)}`,g),"createBgAnsi256"),h=c((e,r,n)=>t(`38;2;${String(e)};${String(r)};${String(n)}`,o),"createRgb"),B=c((e,r,n)=>t(`48;2;${String(e)};${String(r)};${String(n)}`,g),"createBgRgb");m===1?(d=c(e=>t($(Number(e)),o),"createAnsi256"),S=c(e=>t($(Number(e))+k,g),"createBgAnsi256"),h=c((e,r,n)=>t(R(Number(e),Number(r),Number(n)),o),"createRgb"),B=c((e,r,n)=>t(R(Number(e),Number(r),Number(n))+k,g),"createBgRgb")):m===2&&(h=O(d),B=O(S));const A={bold:t(1,22),dim:t(2,22),hidden:t(8,28),inverse:t(7,27),italic:t(3,23),overline:t(53,55),reset:t(0,0),strike:t(9,29),strikethrough:t(9,29),underline:t(4,24),visible:w},N={bgBlack:t(40,g),bgBlackBright:t(100,g),bgBlue:t(44,g),bgBlueBright:t(104,g),bgCyan:t(46,g),bgCyanBright:t(106,g),bgGray:t(100,g),bgGreen:t(42,g),bgGreenBright:t(102,g),bgGrey:t(100,g),bgMagenta:t(45,g),bgMagentaBright:t(105,g),bgRed:t(41,g),bgRedBright:t(101,g),bgWhite:t(47,g),bgWhiteBright:t(107,g),bgYellow:t(43,g),bgYellowBright:t(103,g),black:t(30,o),blackBright:t(90,o),blue:t(34,o),blueBright:t(94,o),cyan:t(36,o),cyanBright:t(96,o),gray:t(90,o),green:t(32,o),greenBright:t(92,o),grey:t(90,o),magenta:t(35,o),magentaBright:t(95,o),red:t(31,o),redBright:t(91,o),white:t(37,o),whiteBright:t(97,o),yellow:t(33,o),yellowBright:t(93,o)},P={bg:c(e=>S(s(e,0,255)),"bg"),bgHex:x(B),bgRgb:c((e,r,n)=>B(s(e,0,255),s(r,0,255),s(n,0,255)),"bgRgb"),fg:c(e=>d(s(e,0,255)),"fg"),hex:x(h),rgb:c((e,r,n)=>h(s(e,0,255),s(r,0,255),s(n,0,255)),"rgb")};var D=Object.defineProperty,E=u((e,r)=>D(e,"name",{value:r,configurable:!0}),"s");const Z=E((e,r,n)=>{if(r==="")return e;let i=e.indexOf(r);if(i<0)return e;const a=r.length;let l=0,f="";for(;~i;)f+=e.slice(l,i)+n,l=i+a,i=e.indexOf(r,l);return f+e.slice(l)},"stringReplaceAll");var I=Object.defineProperty,p=u((e,r)=>I(e,"name",{value:r,configurable:!0}),"a");const b={};let y=null;const J=p((e,r,n)=>{if(!e)return"";let i;if(e.raw===void 0?i=String(e):i=String.raw(e,...r),i.includes("\x1B"))for(let a=n;a;a=a.props)i=Z(i,a.close,a.open);return i.includes(`
|
|
2
|
+
`)&&(i=i.replace(/(\r*\n)/g,`${n.closeStack}$1${n.openStack}`)),n.openStack+i+n.closeStack},"wrapText"),v=p(({props:e},{close:r,open:n})=>{const i=(e?.openStack??"")+n,a=r+(e?.closeStack??""),l=p((f,...C)=>J(f,C,l.props),"style");return Object.setPrototypeOf(l,y),l.props={close:r,closeStack:a,open:n,openStack:i,props:e},l.open=i,l.close=a,l},"createStyle"),V=p(function(){const e=p(r=>String(r),"self");e.strip=r=>r.replaceAll(j(),"");for(const r in N)b[r]={get(){const n=v(this,N[r]);return Object.defineProperty(this,r,{value:n}),n}};for(const r in A)b[r]={get(){const n=v(this,A[r]);return Object.defineProperty(this,r,{value:n}),n}};return y=Object.defineProperties({},b),Object.setPrototypeOf(e,y),e},"Colorize");for(const e in P)b[e]={get(){return(...r)=>v(this,P[e](...r))}};b.ansi256=b.fg;b.bgAnsi256=b.bg;export{V as A};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var T=Object.defineProperty;var u=(e,r)=>T(e,"name",{value:r,configurable:!0});const C=require("@visulima/is-ansi-color-supported"),q=require("./convertHexToRgb-Dvalc5FD.cjs"),p=require("./rgbToAnsi256--f09kvlF.cjs");var G=Object.defineProperty,H=u((e,r)=>G(e,"name",{value:r,configurable:!0}),"e");function P({onlyFirst:e=!1}={}){const r="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(r,e?void 0:"g")}u(P,"t$1");H(P,"ansiRegex");var M=Object.defineProperty,F=u((e,r)=>M(e,"name",{value:r,configurable:!0}),"n$1");const l=F((e,r,n)=>r>e?r:Math.min(e,n),"clamp");var W=Object.defineProperty,c=u((e,r)=>W(e,"name",{value:r,configurable:!0}),"b");const o=39,g=49,A=10,S=C.isStdoutColorSupported(),j={close:"",open:""},t=S>0?(e,r)=>({close:`\x1B[${String(r)}m`,open:`\x1B[${String(e)}m`}):()=>j,R=c(e=>(r,n,i)=>e(p.rgbToAnsi256(Number(r),Number(n),Number(i))),"createRgbFunction"),k=c(e=>r=>{const[n,i,s]=q.convertHexToRgb(r);return e(n,i,s)},"createHexFunction");let y=c(e=>t(`38;5;${String(e)}`,o),"createAnsi256"),m=c(e=>t(`48;5;${String(e)}`,g),"createBgAnsi256"),B=c((e,r,n)=>t(`38;2;${String(e)};${String(r)};${String(n)}`,o),"createRgb"),d=c((e,r,n)=>t(`48;2;${String(e)};${String(r)};${String(n)}`,g),"createBgRgb");S===1?(y=c(e=>t(p.ansi256To16(Number(e)),o),"createAnsi256"),m=c(e=>t(p.ansi256To16(Number(e))+A,g),"createBgAnsi256"),B=c((e,r,n)=>t(p.rgbToAnsi16(Number(e),Number(r),Number(n)),o),"createRgb"),d=c((e,r,n)=>t(p.rgbToAnsi16(Number(e),Number(r),Number(n))+A,g),"createBgRgb")):S===2&&(B=R(y),d=R(m));const O={bold:t(1,22),dim:t(2,22),hidden:t(8,28),inverse:t(7,27),italic:t(3,23),overline:t(53,55),reset:t(0,0),strike:t(9,29),strikethrough:t(9,29),underline:t(4,24),visible:j},x={bgBlack:t(40,g),bgBlackBright:t(100,g),bgBlue:t(44,g),bgBlueBright:t(104,g),bgCyan:t(46,g),bgCyanBright:t(106,g),bgGray:t(100,g),bgGreen:t(42,g),bgGreenBright:t(102,g),bgGrey:t(100,g),bgMagenta:t(45,g),bgMagentaBright:t(105,g),bgRed:t(41,g),bgRedBright:t(101,g),bgWhite:t(47,g),bgWhiteBright:t(107,g),bgYellow:t(43,g),bgYellowBright:t(103,g),black:t(30,o),blackBright:t(90,o),blue:t(34,o),blueBright:t(94,o),cyan:t(36,o),cyanBright:t(96,o),gray:t(90,o),green:t(32,o),greenBright:t(92,o),grey:t(90,o),magenta:t(35,o),magentaBright:t(95,o),red:t(31,o),redBright:t(91,o),white:t(37,o),whiteBright:t(97,o),yellow:t(33,o),yellowBright:t(93,o)},N={bg:c(e=>m(l(e,0,255)),"bg"),bgHex:k(d),bgRgb:c((e,r,n)=>d(l(e,0,255),l(r,0,255),l(n,0,255)),"bgRgb"),fg:c(e=>y(l(e,0,255)),"fg"),hex:k(B),rgb:c((e,r,n)=>B(l(e,0,255),l(r,0,255),l(n,0,255)),"rgb")};var Y=Object.defineProperty,z=u((e,r)=>Y(e,"name",{value:r,configurable:!0}),"s");const D=z((e,r,n)=>{if(r==="")return e;let i=e.indexOf(r);if(i<0)return e;const s=r.length;let a=0,h="";for(;~i;)h+=e.slice(a,i)+n,a=i+s,i=e.indexOf(r,a);return h+e.slice(a)},"stringReplaceAll");var E=Object.defineProperty,f=u((e,r)=>E(e,"name",{value:r,configurable:!0}),"a");const b={};let v=null;const Z=f((e,r,n)=>{if(!e)return"";let i;if(e.raw===void 0?i=String(e):i=String.raw(e,...r),i.includes("\x1B"))for(let s=n;s;s=s.props)i=D(i,s.close,s.open);return i.includes(`
|
|
2
|
+
`)&&(i=i.replace(/(\r*\n)/g,`${n.closeStack}$1${n.openStack}`)),n.openStack+i+n.closeStack},"wrapText"),$=f(({props:e},{close:r,open:n})=>{const i=(e?.openStack??"")+n,s=r+(e?.closeStack??""),a=f((h,...w)=>Z(h,w,a.props),"style");return Object.setPrototypeOf(a,v),a.props={close:r,closeStack:s,open:n,openStack:i,props:e},a.open=i,a.close=s,a},"createStyle"),I=f(function(){const e=f(r=>String(r),"self");e.strip=r=>r.replaceAll(P(),"");for(const r in x)b[r]={get(){const n=$(this,x[r]);return Object.defineProperty(this,r,{value:n}),n}};for(const r in O)b[r]={get(){const n=$(this,O[r]);return Object.defineProperty(this,r,{value:n}),n}};return v=Object.defineProperties({},b),Object.setPrototypeOf(e,v),e},"Colorize");for(const e in N)b[e]={get(){return(...r)=>$(this,N[e](...r))}};b.ansi256=b.fg;b.bgAnsi256=b.bg;exports.A=I;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=Object.defineProperty;var s=(r,e)=>i(r,"name",{value:e,configurable:!0});var u=Object.defineProperty,b=s((r,e)=>u(r,"name",{value:e,configurable:!0}),"a");const f=/([a-f\d]{3,6})/i,l=b(r=>{let[,e]=f.exec(r)??[];const n=e?e.length:0;if(n===3){const c=e.charAt(0),o=e.charAt(1),a=e.charAt(2);e=c+c+o+o+a+a}else if(n!==6)return[0,0,0];const t=Number.parseInt(e,16);return[t>>16&255,t>>8&255,t&255]},"convertHexToRgb");export{l as convertHexToRgb};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var u=Object.defineProperty;var s=(t,e)=>u(t,"name",{value:e,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=Object.defineProperty,l=s((t,e)=>i(t,"name",{value:e,configurable:!0}),"a");const b=/([a-f\d]{3,6})/i,g=l(t=>{let[,e]=b.exec(t)??[];const o=e?e.length:0;if(o===3){const n=e.charAt(0),c=e.charAt(1),a=e.charAt(2);e=n+n+c+c+a+a}else if(o!==6)return[0,0,0];const r=Number.parseInt(e,16);return[r>>16&255,r>>8&255,r&255]},"convertHexToRgb");exports.convertHexToRgb=g;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var d=Object.defineProperty;var s=(o,t)=>d(o,"name",{value:t,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var l=Object.defineProperty,a=s((o,t)=>l(o,"name",{value:t,configurable:!0}),"e");const M=a((o,t,e)=>o===t&&t===e?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/51)+6*Math.round(t/51)+Math.round(e/51),"rgbToAnsi256"),b=a(o=>{let t,e,n;if(o<8)return 30+o;if(o<16)return 90+(o-8);if(o>=232)t=e=n=((o-232)*10+8)/255;else{o-=16;const i=o%36;t=Math.floor(o/36)/5,e=Math.floor(i/6)/5,n=i%6/5}const r=Math.max(t,e,n)*2;if(r===0)return 30;const u=30+(Math.round(n)<<2|Math.round(e)<<1|Math.round(t));return r===2?u+60:u},"ansi256To16"),h=a((o,t,e)=>b(M(o,t,e)),"rgbToAnsi16");exports.ansi256To16=b;exports.rgbToAnsi16=h;exports.rgbToAnsi256=M;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var h=Object.defineProperty;var s=(o,n)=>h(o,"name",{value:n,configurable:!0});var M=Object.defineProperty,e=s((o,n)=>M(o,"name",{value:n,configurable:!0}),"e");const d=e((o,n,t)=>o===n&&n===t?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/51)+6*Math.round(n/51)+Math.round(t/51),"rgbToAnsi256"),f=e(o=>{let n,t,a;if(o<8)return 30+o;if(o<16)return 90+(o-8);if(o>=232)n=t=a=((o-232)*10+8)/255;else{o-=16;const i=o%36;n=Math.floor(o/36)/5,t=Math.floor(i/6)/5,a=i%6/5}const r=Math.max(n,t,a)*2;if(r===0)return 30;const u=30+(Math.round(a)<<2|Math.round(t)<<1|Math.round(n));return r===2?u+60:u},"ansi256To16"),c=e((o,n,t)=>f(d(o,n,t)),"rgbToAnsi16");export{f as ansi256To16,c as rgbToAnsi16,d as rgbToAnsi256};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
type ColorValueHex = `#${string}`;
|
|
2
|
+
interface ColorizeType {
|
|
3
|
+
/**
|
|
4
|
+
* Return styled string.
|
|
5
|
+
* @param {string | TemplateStringsArray} string
|
|
6
|
+
*/
|
|
7
|
+
(string: number | string): string;
|
|
8
|
+
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for foreground color.
|
|
11
|
+
*
|
|
12
|
+
* Code ranges:
|
|
13
|
+
* ```
|
|
14
|
+
* 0 - 7: standard colors
|
|
15
|
+
* 8 - 15: high intensity colors
|
|
16
|
+
* 16 - 231: 6 × 6 × 6 cube (216 colors)
|
|
17
|
+
* 232 - 255: grayscale from black to white in 24 steps
|
|
18
|
+
* ```
|
|
19
|
+
* @param {number} code in range [0, 255].
|
|
20
|
+
*/
|
|
21
|
+
ansi256: (code: number) => this;
|
|
22
|
+
/**
|
|
23
|
+
* Alias for bgAnsi256.
|
|
24
|
+
* @param {number} code in range [0, 255].
|
|
25
|
+
*/
|
|
26
|
+
bg: (code: number) => this;
|
|
27
|
+
/**
|
|
28
|
+
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for background color.
|
|
29
|
+
*
|
|
30
|
+
* Code ranges:
|
|
31
|
+
* ```
|
|
32
|
+
* 0 - 7: standard colors
|
|
33
|
+
* 8 - 15: high intensity colors
|
|
34
|
+
* 16 - 231: 6 × 6 × 6 cube (216 colors)
|
|
35
|
+
* 232 - 255: grayscale from black to white in 24 steps
|
|
36
|
+
* ```
|
|
37
|
+
* @param {number} code in range [0, 255].
|
|
38
|
+
*/
|
|
39
|
+
bgAnsi256: (code: number) => this;
|
|
40
|
+
readonly bgBlack: this;
|
|
41
|
+
readonly bgBlackBright: this;
|
|
42
|
+
readonly bgBlue: this;
|
|
43
|
+
readonly bgBlueBright: this;
|
|
44
|
+
readonly bgCyan: this;
|
|
45
|
+
readonly bgCyanBright: this;
|
|
46
|
+
readonly bgGray: this;
|
|
47
|
+
readonly bgGreen: this;
|
|
48
|
+
readonly bgGreenBright: this;
|
|
49
|
+
readonly bgGrey: this;
|
|
50
|
+
/**
|
|
51
|
+
* Set HEX value for background color.
|
|
52
|
+
* @param {string} color
|
|
53
|
+
*/
|
|
54
|
+
bgHex: (color: ColorValueHex) => this;
|
|
55
|
+
readonly bgMagenta: this;
|
|
56
|
+
readonly bgMagentaBright: this;
|
|
57
|
+
readonly bgRed: this;
|
|
58
|
+
readonly bgRedBright: this;
|
|
59
|
+
/**
|
|
60
|
+
* Set RGB values for background color.
|
|
61
|
+
* @param {number} red The red value, in range [0, 255].
|
|
62
|
+
* @param {number} green The green value, in range [0, 255].
|
|
63
|
+
* @param {number} blue The blue value, in range [0, 255].
|
|
64
|
+
*/
|
|
65
|
+
bgRgb: (red: number, green: number, blue: number) => this;
|
|
66
|
+
readonly bgWhite: this;
|
|
67
|
+
readonly bgWhiteBright: this;
|
|
68
|
+
readonly bgYellow: this;
|
|
69
|
+
readonly bgYellowBright: this;
|
|
70
|
+
readonly black: this;
|
|
71
|
+
readonly blackBright: this;
|
|
72
|
+
readonly blue: this;
|
|
73
|
+
readonly blueBright: this;
|
|
74
|
+
/** <b>Bold</b> style (high intensity). */
|
|
75
|
+
readonly bold: this;
|
|
76
|
+
/** The ANSI escape sequences for ending the current style. */
|
|
77
|
+
readonly close: string;
|
|
78
|
+
readonly cyan: this;
|
|
79
|
+
readonly cyanBright: this;
|
|
80
|
+
/** Faint style (low intensity or dim). */
|
|
81
|
+
readonly dim: this;
|
|
82
|
+
/**
|
|
83
|
+
* Alias for ansi256.
|
|
84
|
+
* @param {number} code in range [0, 255].
|
|
85
|
+
*/
|
|
86
|
+
fg: (code: number) => this;
|
|
87
|
+
readonly gray: this;
|
|
88
|
+
readonly green: this;
|
|
89
|
+
readonly greenBright: this;
|
|
90
|
+
readonly grey: this;
|
|
91
|
+
/**
|
|
92
|
+
* Set HEX value for foreground color.
|
|
93
|
+
* @param {string} color
|
|
94
|
+
*/
|
|
95
|
+
hex: (color: ColorValueHex) => this;
|
|
96
|
+
/** Print the invisible text. */
|
|
97
|
+
readonly hidden: this;
|
|
98
|
+
/** Invert background and foreground colors. */
|
|
99
|
+
readonly inverse: this;
|
|
100
|
+
/** <i>Italic</i> style. (Not widely supported) */
|
|
101
|
+
readonly italic: this;
|
|
102
|
+
readonly magenta: this;
|
|
103
|
+
readonly magentaBright: this;
|
|
104
|
+
/** The ANSI escape sequences for starting the current style. */
|
|
105
|
+
readonly open: string;
|
|
106
|
+
/** O̅v̅e̅r̅l̅i̅n̅e̅ style. (Not widely supported) */
|
|
107
|
+
readonly overline: this;
|
|
108
|
+
readonly red: this;
|
|
109
|
+
readonly redBright: this;
|
|
110
|
+
/** Reset the current style. */
|
|
111
|
+
readonly reset: this;
|
|
112
|
+
/**
|
|
113
|
+
* Set RGB values for foreground color.
|
|
114
|
+
* @param {number} red The red value, in range [0, 255].
|
|
115
|
+
* @param {number} green The green value, in range [0, 255].
|
|
116
|
+
* @param {number} blue The blue value, in range [0, 255].
|
|
117
|
+
*/
|
|
118
|
+
rgb: (red: number, green: number, blue: number) => this;
|
|
119
|
+
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) The alias for `strikethrough`. */
|
|
120
|
+
readonly strike: this;
|
|
121
|
+
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) */
|
|
122
|
+
readonly strikethrough: this;
|
|
123
|
+
/**
|
|
124
|
+
* Remove ANSI styling codes.
|
|
125
|
+
* @param {string} string
|
|
126
|
+
* @returns {string}
|
|
127
|
+
*/
|
|
128
|
+
strip: (string: string) => string;
|
|
129
|
+
/** U̲n̲d̲e̲r̲l̲i̲n̲e̲ style. (Not widely supported) */
|
|
130
|
+
readonly underline: this;
|
|
131
|
+
/** Print visible text without ANSI styling. */
|
|
132
|
+
readonly visible: this;
|
|
133
|
+
readonly white: this;
|
|
134
|
+
readonly whiteBright: this;
|
|
135
|
+
readonly yellow: this;
|
|
136
|
+
readonly yellowBright: this;
|
|
137
|
+
}
|
|
138
|
+
type CssColorName = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
|
|
139
|
+
type StopInput = {
|
|
140
|
+
color?: ColorValueHex | CssColorName | RGB | [number, number, number];
|
|
141
|
+
colorLess?: boolean;
|
|
142
|
+
position: number;
|
|
143
|
+
};
|
|
144
|
+
type StopOutput = {
|
|
145
|
+
color: [number, number, number] | undefined;
|
|
146
|
+
colorLess?: boolean;
|
|
147
|
+
position: number;
|
|
148
|
+
};
|
|
149
|
+
type RGB = {
|
|
150
|
+
b: number;
|
|
151
|
+
g: number;
|
|
152
|
+
r: number;
|
|
153
|
+
};
|
|
154
|
+
export { ColorizeType as C, RGB as R, StopOutput as S, ColorValueHex as a, CssColorName as b, StopInput as c };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
type ColorValueHex = `#${string}`;
|
|
2
|
+
interface ColorizeType {
|
|
3
|
+
/**
|
|
4
|
+
* Return styled string.
|
|
5
|
+
* @param {string | TemplateStringsArray} string
|
|
6
|
+
*/
|
|
7
|
+
(string: number | string): string;
|
|
8
|
+
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for foreground color.
|
|
11
|
+
*
|
|
12
|
+
* Code ranges:
|
|
13
|
+
* ```
|
|
14
|
+
* 0 - 7: standard colors
|
|
15
|
+
* 8 - 15: high intensity colors
|
|
16
|
+
* 16 - 231: 6 × 6 × 6 cube (216 colors)
|
|
17
|
+
* 232 - 255: grayscale from black to white in 24 steps
|
|
18
|
+
* ```
|
|
19
|
+
* @param {number} code in range [0, 255].
|
|
20
|
+
*/
|
|
21
|
+
ansi256: (code: number) => this;
|
|
22
|
+
/**
|
|
23
|
+
* Alias for bgAnsi256.
|
|
24
|
+
* @param {number} code in range [0, 255].
|
|
25
|
+
*/
|
|
26
|
+
bg: (code: number) => this;
|
|
27
|
+
/**
|
|
28
|
+
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for background color.
|
|
29
|
+
*
|
|
30
|
+
* Code ranges:
|
|
31
|
+
* ```
|
|
32
|
+
* 0 - 7: standard colors
|
|
33
|
+
* 8 - 15: high intensity colors
|
|
34
|
+
* 16 - 231: 6 × 6 × 6 cube (216 colors)
|
|
35
|
+
* 232 - 255: grayscale from black to white in 24 steps
|
|
36
|
+
* ```
|
|
37
|
+
* @param {number} code in range [0, 255].
|
|
38
|
+
*/
|
|
39
|
+
bgAnsi256: (code: number) => this;
|
|
40
|
+
readonly bgBlack: this;
|
|
41
|
+
readonly bgBlackBright: this;
|
|
42
|
+
readonly bgBlue: this;
|
|
43
|
+
readonly bgBlueBright: this;
|
|
44
|
+
readonly bgCyan: this;
|
|
45
|
+
readonly bgCyanBright: this;
|
|
46
|
+
readonly bgGray: this;
|
|
47
|
+
readonly bgGreen: this;
|
|
48
|
+
readonly bgGreenBright: this;
|
|
49
|
+
readonly bgGrey: this;
|
|
50
|
+
/**
|
|
51
|
+
* Set HEX value for background color.
|
|
52
|
+
* @param {string} color
|
|
53
|
+
*/
|
|
54
|
+
bgHex: (color: ColorValueHex) => this;
|
|
55
|
+
readonly bgMagenta: this;
|
|
56
|
+
readonly bgMagentaBright: this;
|
|
57
|
+
readonly bgRed: this;
|
|
58
|
+
readonly bgRedBright: this;
|
|
59
|
+
/**
|
|
60
|
+
* Set RGB values for background color.
|
|
61
|
+
* @param {number} red The red value, in range [0, 255].
|
|
62
|
+
* @param {number} green The green value, in range [0, 255].
|
|
63
|
+
* @param {number} blue The blue value, in range [0, 255].
|
|
64
|
+
*/
|
|
65
|
+
bgRgb: (red: number, green: number, blue: number) => this;
|
|
66
|
+
readonly bgWhite: this;
|
|
67
|
+
readonly bgWhiteBright: this;
|
|
68
|
+
readonly bgYellow: this;
|
|
69
|
+
readonly bgYellowBright: this;
|
|
70
|
+
readonly black: this;
|
|
71
|
+
readonly blackBright: this;
|
|
72
|
+
readonly blue: this;
|
|
73
|
+
readonly blueBright: this;
|
|
74
|
+
/** <b>Bold</b> style (high intensity). */
|
|
75
|
+
readonly bold: this;
|
|
76
|
+
/** The ANSI escape sequences for ending the current style. */
|
|
77
|
+
readonly close: string;
|
|
78
|
+
readonly cyan: this;
|
|
79
|
+
readonly cyanBright: this;
|
|
80
|
+
/** Faint style (low intensity or dim). */
|
|
81
|
+
readonly dim: this;
|
|
82
|
+
/**
|
|
83
|
+
* Alias for ansi256.
|
|
84
|
+
* @param {number} code in range [0, 255].
|
|
85
|
+
*/
|
|
86
|
+
fg: (code: number) => this;
|
|
87
|
+
readonly gray: this;
|
|
88
|
+
readonly green: this;
|
|
89
|
+
readonly greenBright: this;
|
|
90
|
+
readonly grey: this;
|
|
91
|
+
/**
|
|
92
|
+
* Set HEX value for foreground color.
|
|
93
|
+
* @param {string} color
|
|
94
|
+
*/
|
|
95
|
+
hex: (color: ColorValueHex) => this;
|
|
96
|
+
/** Print the invisible text. */
|
|
97
|
+
readonly hidden: this;
|
|
98
|
+
/** Invert background and foreground colors. */
|
|
99
|
+
readonly inverse: this;
|
|
100
|
+
/** <i>Italic</i> style. (Not widely supported) */
|
|
101
|
+
readonly italic: this;
|
|
102
|
+
readonly magenta: this;
|
|
103
|
+
readonly magentaBright: this;
|
|
104
|
+
/** The ANSI escape sequences for starting the current style. */
|
|
105
|
+
readonly open: string;
|
|
106
|
+
/** O̅v̅e̅r̅l̅i̅n̅e̅ style. (Not widely supported) */
|
|
107
|
+
readonly overline: this;
|
|
108
|
+
readonly red: this;
|
|
109
|
+
readonly redBright: this;
|
|
110
|
+
/** Reset the current style. */
|
|
111
|
+
readonly reset: this;
|
|
112
|
+
/**
|
|
113
|
+
* Set RGB values for foreground color.
|
|
114
|
+
* @param {number} red The red value, in range [0, 255].
|
|
115
|
+
* @param {number} green The green value, in range [0, 255].
|
|
116
|
+
* @param {number} blue The blue value, in range [0, 255].
|
|
117
|
+
*/
|
|
118
|
+
rgb: (red: number, green: number, blue: number) => this;
|
|
119
|
+
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) The alias for `strikethrough`. */
|
|
120
|
+
readonly strike: this;
|
|
121
|
+
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) */
|
|
122
|
+
readonly strikethrough: this;
|
|
123
|
+
/**
|
|
124
|
+
* Remove ANSI styling codes.
|
|
125
|
+
* @param {string} string
|
|
126
|
+
* @returns {string}
|
|
127
|
+
*/
|
|
128
|
+
strip: (string: string) => string;
|
|
129
|
+
/** U̲n̲d̲e̲r̲l̲i̲n̲e̲ style. (Not widely supported) */
|
|
130
|
+
readonly underline: this;
|
|
131
|
+
/** Print visible text without ANSI styling. */
|
|
132
|
+
readonly visible: this;
|
|
133
|
+
readonly white: this;
|
|
134
|
+
readonly whiteBright: this;
|
|
135
|
+
readonly yellow: this;
|
|
136
|
+
readonly yellowBright: this;
|
|
137
|
+
}
|
|
138
|
+
type CssColorName = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
|
|
139
|
+
type StopInput = {
|
|
140
|
+
color?: ColorValueHex | CssColorName | RGB | [number, number, number];
|
|
141
|
+
colorLess?: boolean;
|
|
142
|
+
position: number;
|
|
143
|
+
};
|
|
144
|
+
type StopOutput = {
|
|
145
|
+
color: [number, number, number] | undefined;
|
|
146
|
+
colorLess?: boolean;
|
|
147
|
+
position: number;
|
|
148
|
+
};
|
|
149
|
+
type RGB = {
|
|
150
|
+
b: number;
|
|
151
|
+
g: number;
|
|
152
|
+
r: number;
|
|
153
|
+
};
|
|
154
|
+
export { ColorizeType as C, RGB as R, StopOutput as S, ColorValueHex as a, CssColorName as b, StopInput as c };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
type ColorValueHex = `#${string}`;
|
|
2
|
+
interface ColorizeType {
|
|
3
|
+
/**
|
|
4
|
+
* Return styled string.
|
|
5
|
+
* @param {string | TemplateStringsArray} string
|
|
6
|
+
*/
|
|
7
|
+
(string: number | string): string;
|
|
8
|
+
(string: TemplateStringsArray, ...parameters: string[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for foreground color.
|
|
11
|
+
*
|
|
12
|
+
* Code ranges:
|
|
13
|
+
* ```
|
|
14
|
+
* 0 - 7: standard colors
|
|
15
|
+
* 8 - 15: high intensity colors
|
|
16
|
+
* 16 - 231: 6 × 6 × 6 cube (216 colors)
|
|
17
|
+
* 232 - 255: grayscale from black to white in 24 steps
|
|
18
|
+
* ```
|
|
19
|
+
* @param {number} code in range [0, 255].
|
|
20
|
+
*/
|
|
21
|
+
ansi256: (code: number) => this;
|
|
22
|
+
/**
|
|
23
|
+
* Alias for bgAnsi256.
|
|
24
|
+
* @param {number} code in range [0, 255].
|
|
25
|
+
*/
|
|
26
|
+
bg: (code: number) => this;
|
|
27
|
+
/**
|
|
28
|
+
* Set [256-color ANSI code](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) for background color.
|
|
29
|
+
*
|
|
30
|
+
* Code ranges:
|
|
31
|
+
* ```
|
|
32
|
+
* 0 - 7: standard colors
|
|
33
|
+
* 8 - 15: high intensity colors
|
|
34
|
+
* 16 - 231: 6 × 6 × 6 cube (216 colors)
|
|
35
|
+
* 232 - 255: grayscale from black to white in 24 steps
|
|
36
|
+
* ```
|
|
37
|
+
* @param {number} code in range [0, 255].
|
|
38
|
+
*/
|
|
39
|
+
bgAnsi256: (code: number) => this;
|
|
40
|
+
readonly bgBlack: this;
|
|
41
|
+
readonly bgBlackBright: this;
|
|
42
|
+
readonly bgBlue: this;
|
|
43
|
+
readonly bgBlueBright: this;
|
|
44
|
+
readonly bgCyan: this;
|
|
45
|
+
readonly bgCyanBright: this;
|
|
46
|
+
readonly bgGray: this;
|
|
47
|
+
readonly bgGreen: this;
|
|
48
|
+
readonly bgGreenBright: this;
|
|
49
|
+
readonly bgGrey: this;
|
|
50
|
+
/**
|
|
51
|
+
* Set HEX value for background color.
|
|
52
|
+
* @param {string} color
|
|
53
|
+
*/
|
|
54
|
+
bgHex: (color: ColorValueHex) => this;
|
|
55
|
+
readonly bgMagenta: this;
|
|
56
|
+
readonly bgMagentaBright: this;
|
|
57
|
+
readonly bgRed: this;
|
|
58
|
+
readonly bgRedBright: this;
|
|
59
|
+
/**
|
|
60
|
+
* Set RGB values for background color.
|
|
61
|
+
* @param {number} red The red value, in range [0, 255].
|
|
62
|
+
* @param {number} green The green value, in range [0, 255].
|
|
63
|
+
* @param {number} blue The blue value, in range [0, 255].
|
|
64
|
+
*/
|
|
65
|
+
bgRgb: (red: number, green: number, blue: number) => this;
|
|
66
|
+
readonly bgWhite: this;
|
|
67
|
+
readonly bgWhiteBright: this;
|
|
68
|
+
readonly bgYellow: this;
|
|
69
|
+
readonly bgYellowBright: this;
|
|
70
|
+
readonly black: this;
|
|
71
|
+
readonly blackBright: this;
|
|
72
|
+
readonly blue: this;
|
|
73
|
+
readonly blueBright: this;
|
|
74
|
+
/** <b>Bold</b> style (high intensity). */
|
|
75
|
+
readonly bold: this;
|
|
76
|
+
/** The ANSI escape sequences for ending the current style. */
|
|
77
|
+
readonly close: string;
|
|
78
|
+
readonly cyan: this;
|
|
79
|
+
readonly cyanBright: this;
|
|
80
|
+
/** Faint style (low intensity or dim). */
|
|
81
|
+
readonly dim: this;
|
|
82
|
+
/**
|
|
83
|
+
* Alias for ansi256.
|
|
84
|
+
* @param {number} code in range [0, 255].
|
|
85
|
+
*/
|
|
86
|
+
fg: (code: number) => this;
|
|
87
|
+
readonly gray: this;
|
|
88
|
+
readonly green: this;
|
|
89
|
+
readonly greenBright: this;
|
|
90
|
+
readonly grey: this;
|
|
91
|
+
/**
|
|
92
|
+
* Set HEX value for foreground color.
|
|
93
|
+
* @param {string} color
|
|
94
|
+
*/
|
|
95
|
+
hex: (color: ColorValueHex) => this;
|
|
96
|
+
/** Print the invisible text. */
|
|
97
|
+
readonly hidden: this;
|
|
98
|
+
/** Invert background and foreground colors. */
|
|
99
|
+
readonly inverse: this;
|
|
100
|
+
/** <i>Italic</i> style. (Not widely supported) */
|
|
101
|
+
readonly italic: this;
|
|
102
|
+
readonly magenta: this;
|
|
103
|
+
readonly magentaBright: this;
|
|
104
|
+
/** The ANSI escape sequences for starting the current style. */
|
|
105
|
+
readonly open: string;
|
|
106
|
+
/** O̅v̅e̅r̅l̅i̅n̅e̅ style. (Not widely supported) */
|
|
107
|
+
readonly overline: this;
|
|
108
|
+
readonly red: this;
|
|
109
|
+
readonly redBright: this;
|
|
110
|
+
/** Reset the current style. */
|
|
111
|
+
readonly reset: this;
|
|
112
|
+
/**
|
|
113
|
+
* Set RGB values for foreground color.
|
|
114
|
+
* @param {number} red The red value, in range [0, 255].
|
|
115
|
+
* @param {number} green The green value, in range [0, 255].
|
|
116
|
+
* @param {number} blue The blue value, in range [0, 255].
|
|
117
|
+
*/
|
|
118
|
+
rgb: (red: number, green: number, blue: number) => this;
|
|
119
|
+
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) The alias for `strikethrough`. */
|
|
120
|
+
readonly strike: this;
|
|
121
|
+
/** S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style. (Not widely supported) */
|
|
122
|
+
readonly strikethrough: this;
|
|
123
|
+
/**
|
|
124
|
+
* Remove ANSI styling codes.
|
|
125
|
+
* @param {string} string
|
|
126
|
+
* @returns {string}
|
|
127
|
+
*/
|
|
128
|
+
strip: (string: string) => string;
|
|
129
|
+
/** U̲n̲d̲e̲r̲l̲i̲n̲e̲ style. (Not widely supported) */
|
|
130
|
+
readonly underline: this;
|
|
131
|
+
/** Print visible text without ANSI styling. */
|
|
132
|
+
readonly visible: this;
|
|
133
|
+
readonly white: this;
|
|
134
|
+
readonly whiteBright: this;
|
|
135
|
+
readonly yellow: this;
|
|
136
|
+
readonly yellowBright: this;
|
|
137
|
+
}
|
|
138
|
+
type CssColorName = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
|
|
139
|
+
type StopInput = {
|
|
140
|
+
color?: ColorValueHex | CssColorName | RGB | [number, number, number];
|
|
141
|
+
colorLess?: boolean;
|
|
142
|
+
position: number;
|
|
143
|
+
};
|
|
144
|
+
type StopOutput = {
|
|
145
|
+
color: [number, number, number] | undefined;
|
|
146
|
+
colorLess?: boolean;
|
|
147
|
+
position: number;
|
|
148
|
+
};
|
|
149
|
+
type RGB = {
|
|
150
|
+
b: number;
|
|
151
|
+
g: number;
|
|
152
|
+
r: number;
|
|
153
|
+
};
|
|
154
|
+
export { ColorizeType as C, RGB as R, StopOutput as S, ColorValueHex as a, CssColorName as b, StopInput as c };
|