Add supports-color typings

This commit is contained in:
Melvin Groenhoff 2016-11-02 17:23:56 +01:00
parent 4c4aeebb1e
commit fbd681b0b8
3 changed files with 51 additions and 0 deletions

15
supports-color/index.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
// Type definitions for supports-color 3.1.2
// Project: https://github.com/chalk/supports-color
// Definitions by: Melvin Groenhoff <https://github.com/mgroenhoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare interface SupportsColor {
level: number;
hasBasic: boolean;
has256: boolean;
has16m: boolean;
}
declare const supportsColor: boolean & SupportsColor;
export = supportsColor;

View File

@ -0,0 +1,17 @@
import supportsColor = require("supports-color");
if (supportsColor) {
// Terminal supports color
}
if (supportsColor.hasBasic) {
// Terminal supports color
}
if (supportsColor.has256) {
// Terminal supports 256 colors
}
if (supportsColor.has16m) {
// Terminal supports 16 million colors (truecolor)
}

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"supports-color-tests.ts"
]
}