@ant-design/fast-color
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -47,2 +47,3 @@ import type { ColorInput, HSL, HSV, RGB } from './types'; | ||
* Returns the perceived brightness of the color, from 0-255. | ||
* Note: this is not the b of HSB | ||
* @see http://www.w3.org/TR/AERT#color-contrast | ||
@@ -49,0 +50,0 @@ */ |
@@ -91,11 +91,2 @@ /** | ||
// Do nothing since already initialized | ||
} else if (input instanceof FastColor) { | ||
this.r = input.r; | ||
this.g = input.g; | ||
this.b = input.b; | ||
this.a = input.a; | ||
this._h = input._h; | ||
this._s = input._s; | ||
this._l = input._l; | ||
this._v = input._v; | ||
} else if (typeof input === 'string') { | ||
@@ -115,2 +106,11 @@ const trimStr = input.trim(); | ||
} | ||
} else if (input instanceof FastColor) { | ||
this.r = input.r; | ||
this.g = input.g; | ||
this.b = input.b; | ||
this.a = input.a; | ||
this._h = input._h; | ||
this._s = input._s; | ||
this._l = input._l; | ||
this._v = input._v; | ||
} else if (matchFormat('rgb')) { | ||
@@ -145,5 +145,5 @@ this.r = limitRange(input.r); | ||
setHue(value) { | ||
const hsl = this.toHsl(); | ||
hsl.h = value; | ||
return new FastColor(hsl); | ||
const hsv = this.toHsv(); | ||
hsv.h = value; | ||
return new FastColor(hsv); | ||
} | ||
@@ -203,2 +203,3 @@ | ||
* Returns the perceived brightness of the color, from 0-255. | ||
* Note: this is not the b of HSB | ||
* @see http://www.w3.org/TR/AERT#color-contrast | ||
@@ -205,0 +206,0 @@ */ |
@@ -47,2 +47,3 @@ import type { ColorInput, HSL, HSV, RGB } from './types'; | ||
* Returns the perceived brightness of the color, from 0-255. | ||
* Note: this is not the b of HSB | ||
* @see http://www.w3.org/TR/AERT#color-contrast | ||
@@ -49,0 +50,0 @@ */ |
@@ -97,11 +97,2 @@ "use strict"; | ||
// Do nothing since already initialized | ||
} else if (input instanceof FastColor) { | ||
this.r = input.r; | ||
this.g = input.g; | ||
this.b = input.b; | ||
this.a = input.a; | ||
this._h = input._h; | ||
this._s = input._s; | ||
this._l = input._l; | ||
this._v = input._v; | ||
} else if (typeof input === 'string') { | ||
@@ -121,2 +112,11 @@ const trimStr = input.trim(); | ||
} | ||
} else if (input instanceof FastColor) { | ||
this.r = input.r; | ||
this.g = input.g; | ||
this.b = input.b; | ||
this.a = input.a; | ||
this._h = input._h; | ||
this._s = input._s; | ||
this._l = input._l; | ||
this._v = input._v; | ||
} else if (matchFormat('rgb')) { | ||
@@ -151,5 +151,5 @@ this.r = limitRange(input.r); | ||
setHue(value) { | ||
const hsl = this.toHsl(); | ||
hsl.h = value; | ||
return new FastColor(hsl); | ||
const hsv = this.toHsv(); | ||
hsv.h = value; | ||
return new FastColor(hsv); | ||
} | ||
@@ -209,2 +209,3 @@ | ||
* Returns the perceived brightness of the color, from 0-255. | ||
* Note: this is not the b of HSB | ||
* @see http://www.w3.org/TR/AERT#color-contrast | ||
@@ -211,0 +212,0 @@ */ |
{ | ||
"name": "@ant-design/fast-color", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "fast and small color class", | ||
"engines": { | ||
"node": ">=8.x" | ||
}, | ||
"keywords": [ | ||
@@ -15,6 +12,4 @@ "react", | ||
"homepage": "https://github.com/ant-design/fast-color", | ||
"author": { | ||
"name": "Guo Yunhe", | ||
"email": "i@guoyunhe.me", | ||
"url": "https://guoyunhe.me/" | ||
"bugs": { | ||
"url": "https://github.com/ant-design/fast-color/issues" | ||
}, | ||
@@ -25,5 +20,10 @@ "repository": { | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ant-design/fast-color/issues" | ||
"license": "MIT", | ||
"author": { | ||
"name": "Guo Yunhe", | ||
"email": "i@guoyunhe.me", | ||
"url": "https://guoyunhe.me/" | ||
}, | ||
"main": "./lib/index", | ||
"module": "./es/index", | ||
"files": [ | ||
@@ -33,16 +33,16 @@ "es", | ||
], | ||
"license": "MIT", | ||
"main": "./lib/index", | ||
"module": "./es/index", | ||
"scripts": { | ||
"start": "dumi dev", | ||
"bench": "vitest bench", | ||
"build": "dumi build", | ||
"compile": "father build", | ||
"prepublishOnly": "npm run compile && np --yolo --no-publish", | ||
"coverage": "rc-test --coverage", | ||
"lint": "eslint src/ tests/ --ext .tsx,.ts,.jsx,.js", | ||
"test": "rc-test", | ||
"coverage": "rc-test --coverage", | ||
"now-build": "npm run build" | ||
"now-build": "npm run build", | ||
"prepublishOnly": "npm run compile", | ||
"start": "dumi dev", | ||
"test": "rc-test" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.24.7" | ||
}, | ||
"devDependencies": { | ||
@@ -64,5 +64,5 @@ "@ctrl/tinycolor": "^4.1.0", | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.24.7" | ||
"engines": { | ||
"node": ">=8.x" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42999
1281