From fbd681b0b805308bf2ae38ca2dac9519c09bd2d2 Mon Sep 17 00:00:00 2001 From: Melvin Groenhoff Date: Wed, 2 Nov 2016 17:23:56 +0100 Subject: [PATCH] Add supports-color typings --- supports-color/index.d.ts | 15 +++++++++++++++ supports-color/supports-color-tests.ts | 17 +++++++++++++++++ supports-color/tsconfig.json | 19 +++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 supports-color/index.d.ts create mode 100644 supports-color/supports-color-tests.ts create mode 100644 supports-color/tsconfig.json diff --git a/supports-color/index.d.ts b/supports-color/index.d.ts new file mode 100644 index 0000000000..34df865d4b --- /dev/null +++ b/supports-color/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for supports-color 3.1.2 +// Project: https://github.com/chalk/supports-color +// Definitions by: Melvin Groenhoff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare interface SupportsColor { + level: number; + hasBasic: boolean; + has256: boolean; + has16m: boolean; +} + +declare const supportsColor: boolean & SupportsColor; + +export = supportsColor; diff --git a/supports-color/supports-color-tests.ts b/supports-color/supports-color-tests.ts new file mode 100644 index 0000000000..2e8d887c58 --- /dev/null +++ b/supports-color/supports-color-tests.ts @@ -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) +} diff --git a/supports-color/tsconfig.json b/supports-color/tsconfig.json new file mode 100644 index 0000000000..77ab01421d --- /dev/null +++ b/supports-color/tsconfig.json @@ -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" + ] +} \ No newline at end of file