@uiw/color-convert
Advanced tools
Comparing version 1.2.3 to 1.2.4
import { HsvaColor } from './'; | ||
export declare const getContrastingColor: (str: string | HsvaColor) => "#fff" | "#000"; | ||
export declare const getContrastingColor: (str: string | HsvaColor) => "#ffffff" | "#000000"; |
@@ -10,8 +10,8 @@ "use strict"; | ||
if (!str) { | ||
return '#fff'; | ||
return '#ffffff'; | ||
} | ||
var col = (0, _.color)(str); | ||
var yiq = (col.rgb.r * 299 + col.rgb.g * 587 + col.rgb.b * 114) / 1000; | ||
return yiq >= 128 ? '#000' : '#fff'; | ||
return yiq >= 128 ? '#000000' : '#ffffff'; | ||
}; | ||
exports.getContrastingColor = getContrastingColor; |
import { HsvaColor } from './'; | ||
export declare const getContrastingColor: (str: string | HsvaColor) => "#fff" | "#000"; | ||
export declare const getContrastingColor: (str: string | HsvaColor) => "#ffffff" | "#000000"; |
import { color } from './'; | ||
export var getContrastingColor = str => { | ||
if (!str) { | ||
return '#fff'; | ||
return '#ffffff'; | ||
} | ||
var col = color(str); | ||
var yiq = (col.rgb.r * 299 + col.rgb.g * 587 + col.rgb.b * 114) / 1000; | ||
return yiq >= 128 ? '#000' : '#fff'; | ||
return yiq >= 128 ? '#000000' : '#ffffff'; | ||
}; |
{ | ||
"name": "@uiw/color-convert", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "Color Convert", | ||
@@ -5,0 +5,0 @@ "author": "Kenny Wong <wowohoo@qq.com>", |
@@ -5,7 +5,7 @@ import { HsvaColor, color } from './'; | ||
if (!str) { | ||
return '#fff'; | ||
return '#ffffff'; | ||
} | ||
const col = color(str); | ||
const yiq = (col.rgb.r * 299 + col.rgb.g * 587 + col.rgb.b * 114) / 1000; | ||
return yiq >= 128 ? '#000' : '#fff'; | ||
return yiq >= 128 ? '#000000' : '#ffffff'; | ||
}; |
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
49506