Socket
Socket
Sign inDemoInstall

@chayns/colors

Package Overview
Dependencies
0
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

2

cjs/converter/hex/rgb255ToHex.js

@@ -28,3 +28,3 @@ "use strict";

var a = Math.round(rgb.a * 255);
return (0, _checkTransparency["default"])("#".concat(componentToHex(r)).concat(componentToHex(g)).concat(componentToHex(b)).concat(componentToHex(a)));
return (0, _checkTransparency["default"])("#".concat(componentToHex(r)).concat(componentToHex(g)).concat(componentToHex(b)).concat(componentToHex(a)), (0, _is.isNumber)(rgb.a));
}

@@ -21,3 +21,9 @@ "use strict";

function checkTransparency(color) {
var hexTransparency = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if ((0, _is.isString)(color)) {
if (hexTransparency) {
return color.substring(0, 9);
}
return color.substring(0, 7);

@@ -24,0 +30,0 @@ } // object

import checkTransparency from '../../utils/checkTransparency';
import { isRgb255 } from '../../utils/is';
import { isNumber, isRgb255 } from '../../utils/is';

@@ -18,3 +18,3 @@ function componentToHex(c) {

var a = Math.round(rgb.a * 255);
return checkTransparency("#".concat(componentToHex(r)).concat(componentToHex(g)).concat(componentToHex(b)).concat(componentToHex(a)));
return checkTransparency("#".concat(componentToHex(r)).concat(componentToHex(g)).concat(componentToHex(b)).concat(componentToHex(a)), isNumber(rgb.a));
}

@@ -13,3 +13,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

export default function checkTransparency(color) {
var hexTransparency = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (isString(color)) {
if (hexTransparency) {
return color.substring(0, 9);
}
return color.substring(0, 7);

@@ -16,0 +22,0 @@ } // object

{
"name": "@chayns/colors",
"version": "1.0.0",
"version": "1.0.1",
"description": "JavaScript utility functions for the calculation of colors for chayns",

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

@@ -46,4 +46,2 @@ # @chayns/colors

- rgb1ToHsv(rgb1)
- rgb255ToRgb1(rgb255)

@@ -53,4 +51,2 @@ - rgb255ToHex(rgb255)

- rgb255ToHsv(rgb255)
- hexToRgb1(hex)

@@ -60,4 +56,2 @@ - hexToRgb255(hex)

- hexToHsv(hex)
- hslToRgb1(hsl)

@@ -67,4 +61,2 @@ - hslToRgb255(hsl)

- hslToHsv(hsl)
- hsvToRgb1(hsv)

@@ -97,7 +89,2 @@ - hsvToRgb255(hsv)

Type check functions:
- isString(value)
- isNumber(value)
- isNullOrUndefined(value)
- isObject(value)
- isInInterval(value)
- isHex(value)

@@ -104,0 +91,0 @@ - isRgbString(value)

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc