dabh / colors.js Goto Github PK
View Code? Open in Web Editor NEWget colors in your node.js console
License: Other
get colors in your node.js console
License: Other
Other TERM
values you may wish to look for:
mintty
, mintty-direct
, etc.vt220
, vt340
, vt420
, vt525
, etc.tmux
Example patch:
return 2;
}
- if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
+ if (/^screen|^tmux|^xterm|^vt[1-5][0-9][0-9]|^rxvt|mintty|color|ansi|cygwin|linux/i.test(env.TERM)) {
return 1;
}
On any modern Linux distro (or whatever) with a reasonly up-to-date terminfo database, you should be able to get a complete list of VT100+ style TERM
values via:
#!/usr/bin/env bash
toe -a | cut -f1 | while read term ; do
if infocmp "$term" | grep -q -e 'bold=[^, ]*\E\[1m' -e 'sgr0=[^, ]*\E\[0?m' ; then
echo "$term"
fi
done
You probably needn't do them all, just the ones that look like they'll be reasonably common. And not all of them support color, though all should support reverse video, bold, underline, etc.
Documentation still mentions the old brightYellow
style, but the interface changed to bold.yellow
/ yellow.bold
.
prototype.__defineGetter__
was been deprecated. Currently it's on legacy version. By using Object.defineProperty
with a getter function can be much more better than __defineGetter__
.Importing @colors/colors will break types (This is extremely rare --- This is the first time I have ever seen this happen)
The following code will run perfectly fine, fully type-safe. However, as soon as you import @colors/colors, it will cause an error.
Even if you import @colors/colors in a separate file (e.g inside a nested folder), it will STILL break the types!
// import colors from '@colors/colors'; // Uncommenting this line will cause the error.
// // You can also move the line to a separate file -- it will STILL cause this error.
import { z } from 'zod';
export type UnionToIntersection<U> = (U extends U ? (u: U) => 0 : never) extends (i: infer I) => 0 ? Extract<I, U> : never;
export type ArrayToIntersection<T extends readonly unknown[]> = UnionToIntersection<T[number]>;
export function arrayToIntersection<T extends readonly any[]>(arr: T): UnionToIntersection<T[number]> {
return '' as any;
}
const tempTrash = arrayToIntersection([
z.object({
foo: z.object({
one: z.string(),
}),
}),
z.object({
foo: z.object({
two: z.string(),
}),
}),
]);
type TempTrash = z.infer<typeof tempTrash>;
const something: TempTrash = { foo: { one: '', two: '' } };
The issue looks to be here:
https://github.com/DABH/colors.js/blob/master/lib/system/has-flag.js#L28
Node is just loading all imports into memory like it always does, and an error shows up:
Some debugging ahead of time will show that neither argv nor process.argv are defined.
Looking for any suggestions as to what can cause this. As the dependency chain comes from winston, I would image you would be seeing more issues raised if it was a straight up bug. Thank you
Since colors
is taken and Marak will probably not let go of the name, how about @DABH/colors
?
Never mind: I see in the other thread you're resolving this with npm. Kudos.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.