Giter Club home page Giter Club logo

colors.js's People

Contributors

adrielcodeco avatar badisi avatar bcaudan avatar brettz9 avatar buschtoens avatar cjc avatar copini avatar dabh avatar danbell avatar ded avatar dependabot[bot] avatar edi9999 avatar fscherwi avatar glitchmasta47 avatar grit96 avatar hashar avatar jamescostian avatar jennings avatar justincampbell avatar konsumer avatar marak avatar mmalecki avatar morganrallen avatar mrjacobbloom avatar osmanmesutozcan avatar oxund avatar paladox avatar pksunkara avatar stevenvachon avatar yursha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

colors.js's Issues

Needs new package name

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.

has-flag.js - seems to assume cli use, causing issue during synchronous module loading

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:
image

Some debugging ahead of time will show that neither argv nor process.argv are defined.
image

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

This breaks unrelated TypeScript types (extremely rare) (Zod)

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: '' } };

supports-colors.js - additional terminals to detect

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.