New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@therms/web-js

Package Overview
Dependencies
Maintainers
4
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@therms/web-js - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [1.3.3](http://bitbucket.org/thermsio/web-js/compare/v1.3.2...v1.3.3) (2021-12-06)
### Bug Fixes
* **CORE-1707:** make getColorContrast work with 3 digit hex codes ; ([98e1596](http://bitbucket.org/thermsio/web-js/commits/98e1596a74a7c58cba0c3319797e3cc7a5d66f34))
## [1.3.2](http://bitbucket.org/thermsio/web-js/compare/v1.3.1...v1.3.2) (2021-11-28)

@@ -2,0 +9,0 @@

14

dist/cjs.js

@@ -233,8 +233,14 @@ 'use strict';

*/
function getColorContrast(hex, { darkColor = '#000', lightColor = '#fff' } = {}) {
function getColorContrast(hex, { darkColor = '#00111abf', lightColor = '#ffffffb3' } = {}) {
if (calculatedMap[hex])
return calculatedMap[hex];
const r = parseInt(hex.substr(1, 2), 16);
const g = parseInt(hex.substr(3, 2), 16);
const b = parseInt(hex.substr(5, 2), 16);
let _hex = hex[0] === '#' ? hex.slice(1) : hex;
if (hex.length < 6) {
_hex = _hex.split('').map((value) => {
return value + value;
}).join('');
}
const r = parseInt(_hex.substring(0, 2), 16);
const g = parseInt(_hex.substring(2, 4), 16);
const b = parseInt(_hex.substring(4, 5), 16);
const yiq = (r * 299 + g * 587 + b * 114) / 1000;

@@ -241,0 +247,0 @@ calculatedMap[hex] = yiq >= 128 ? darkColor : lightColor;

@@ -223,8 +223,14 @@ import Cookie from 'js-cookie';

*/
function getColorContrast(hex, { darkColor = '#000', lightColor = '#fff' } = {}) {
function getColorContrast(hex, { darkColor = '#00111abf', lightColor = '#ffffffb3' } = {}) {
if (calculatedMap[hex])
return calculatedMap[hex];
const r = parseInt(hex.substr(1, 2), 16);
const g = parseInt(hex.substr(3, 2), 16);
const b = parseInt(hex.substr(5, 2), 16);
let _hex = hex[0] === '#' ? hex.slice(1) : hex;
if (hex.length < 6) {
_hex = _hex.split('').map((value) => {
return value + value;
}).join('');
}
const r = parseInt(_hex.substring(0, 2), 16);
const g = parseInt(_hex.substring(2, 4), 16);
const b = parseInt(_hex.substring(4, 5), 16);
const yiq = (r * 299 + g * 587 + b * 114) / 1000;

@@ -231,0 +237,0 @@ calculatedMap[hex] = yiq >= 128 ? darkColor : lightColor;

{
"name": "@therms/web-js",
"version": "1.3.2",
"version": "1.3.3",
"description": "Common web/JS tools & utilities",

@@ -5,0 +5,0 @@ "main": "dist/cjs.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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