Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@theodorejb/color-detect

Package Overview
Dependencies
0
Maintainers
1
Versions
3
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

35

LICENSE.md

@@ -1,20 +0,21 @@

Copyright 2018 Theodore Brown
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
Copyright (c) 2018 Theodore Brown
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
{
"name": "@theodorejb/color-detect",
"version": "1.0.0",
"version": "1.0.1",
"description": "Convert CSS color strings to RGBA and check whether they are light or dark",
"type": "module",
"files": [

@@ -12,5 +13,4 @@ "src/*.js",

"scripts": {
"prepublishOnly": "tsc --module ES2015",
"test": "tsc && browserify test/tests.js -o test/browser/testbundle.js",
"start": "http-server"
"prepare": "tsc",
"start": "ws --port 8080"
},

@@ -34,9 +34,9 @@ "keywords": [

"devDependencies": {
"@types/mocha": "^2.2.48",
"@types/node": "^9.4.7",
"browserify": "^16.1.1",
"http-server": "^0.11.1",
"mocha": "^5.0.4",
"typescript": "^2.7.2"
"@types/chai": "^4.3.0",
"@types/mocha": "^9.1.0",
"chai": "^4.3.6",
"local-web-server": "^5.2.0",
"mocha": "^9.2.2",
"typescript": "^4.6.3"
}
}
# color-detect
[![NPM version](https://img.shields.io/npm/v/@theodorejb/color-detect.svg)](https://www.npmjs.org/package/@theodorejb/color-detect)
[![npm version](https://badge.fury.io/js/%40theodorejb%2Fcolor-detect.svg)](https://badge.fury.io/js/%40theodorejb%2Fcolor-detect)

@@ -7,4 +7,4 @@ Convert color strings to an RGBA array, and determine if the color is light or dark.

* Includes TypeScript definitions
* Works with Webpack and Rollup module bundlers, as well as modern browsers
* No dependencies
* ES6 module compatible with modern browsers and build tools

@@ -20,3 +20,3 @@ ## Installation

// convert CSS colors to RGBA
// convert CSS colors to an RGBA array
colorToRgbaArray('red'); // [255, 0, 0, 255]

@@ -26,5 +26,2 @@ colorToRgbaArray('#123'); // [17, 34, 51, 255]

// convert an RGBA array to CSS color string
rgbaToCssString(colorToRgbaArray('blue')); // rgba(0, 0, 255, 1)
// detect whether a color is light or dark

@@ -36,2 +33,6 @@ isLightColor(colorToRgbaArray('red')); // false

isLightColor(colorToRgbaArray('green')); // false
// convert an RGBA array to CSS color string
let chocolateRgb = colorToRgbaArray('chocolate');
rgbaToCssString(chocolateRgb); // "rgba(210, 105, 30, 1)"
```

@@ -38,0 +39,0 @@

@@ -47,3 +47,3 @@ /**

export function rgbaToCssString(a) {
return "rgba(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] / 255 + ")";
return "rgba(".concat(a[0], ", ").concat(a[1], ", ").concat(a[2], ", ").concat(a[3] / 255, ")");
}
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