mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-06 20:09:15 +08:00
Merge pull request #24546 from VitorLuizC/feature/add-is-color-definition
Add definition for is-color
This commit is contained in:
20
types/is-color/index.d.ts
vendored
Normal file
20
types/is-color/index.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Type definitions for is-color 1.0
|
||||
// Project: https://github.com/morishitter/is-color
|
||||
// Definitions by: Vitor Luiz Cavalcanti <https://github.com/VitorLuizC>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function isColor(str: string): boolean;
|
||||
|
||||
declare namespace isColor {
|
||||
function isRgb(str: string): boolean;
|
||||
function isRgba(str: string): boolean;
|
||||
function isHsl(str: string): boolean;
|
||||
function isHsla(str: string): boolean;
|
||||
function isHex(str: string): boolean;
|
||||
function isKeyword(str: string): boolean;
|
||||
function isInherit(str: string): str is 'inherit';
|
||||
function isCurrentColor(str: string): str is ('currentColor' | 'currentcolor');
|
||||
function isTransparent(str: string): str is 'transparent';
|
||||
}
|
||||
|
||||
export = isColor;
|
||||
23
types/is-color/is-color-tests.ts
Normal file
23
types/is-color/is-color-tests.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import isColor = require('is-color');
|
||||
|
||||
isColor('#000');
|
||||
// => boolean
|
||||
|
||||
isColor.isHex('#000');
|
||||
// => boolean
|
||||
isColor.isHsl('#000');
|
||||
// => boolean
|
||||
isColor.isHsla('#000');
|
||||
// => boolean
|
||||
isColor.isRgb('rgb(0, 0, 0)');
|
||||
// => boolean
|
||||
isColor.isRgba('rgba(0,0,0, 0)');
|
||||
// => boolean
|
||||
isColor.isKeyword('red');
|
||||
// => boolean
|
||||
isColor.isInherit('inherit');
|
||||
// => is 'inherit'
|
||||
isColor.isTransparent('transparent');
|
||||
// => is 'transparent'
|
||||
isColor.isCurrentColor('currentColor');
|
||||
// => is 'currentColor'|'currentcolor'
|
||||
23
types/is-color/tsconfig.json
Normal file
23
types/is-color/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"is-color-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/is-color/tslint.json
Normal file
1
types/is-color/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user