Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uiw/color-convert

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/color-convert - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

2

cjs/getContrastingColor.d.ts
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';
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc