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

colour-rgba

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colour-rgba - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

3

package.json
{
"name": "colour-rgba",
"version": "1.0.0",
"version": "1.0.1",
"description": "A module for creating RGBA Colour objects and manipulating, un/packing and de/serializing them.",

@@ -33,3 +33,2 @@ "main": "src/colour.js",

"dependencies": {
"bytebuffer": "^5.0.1",
"extended-math": "^1.0.4",

@@ -36,0 +35,0 @@ "extra-utilities": "^1.3.0"

@@ -20,3 +20,3 @@ # Colour RGBA

// or use a pre-defined colour
var red = Colour.RED;
var red = Colour.LimeGreen;

@@ -23,0 +23,0 @@ // convert a colour to an array excluding the alpha channel

@@ -5,3 +5,2 @@ "use strict";

const extendedMath = require("extended-math");
const ByteBuffer = require("bytebuffer");

@@ -161,6 +160,2 @@ class Colour {

static deserialize(buffer) {
if(ByteBuffer.isByteBuffer(buffer)) {
buffer = buffer.toBuffer();
}
if(!Buffer.isBuffer(buffer)) {

@@ -194,16 +189,13 @@ return null;

let paletteByteBuffer = new ByteBuffer(includeAlpha ? 4 : 3);
paletteByteBuffer.order(true);
let paletteBuffer = Buffer.alloc(includeAlpha ? 4 : 3);
paletteByteBuffer.writeUint8(this.r);
paletteByteBuffer.writeUint8(this.g);
paletteByteBuffer.writeUint8(this.b);
paletteBuffer.writeUInt8(this.r, 0);
paletteBuffer.writeUInt8(this.g, 1);
paletteBuffer.writeUInt8(this.b, 2);
if(includeAlpha) {
paletteByteBuffer.writeUint8(this.a);
paletteBuffer.writeUInt8(this.a, 3);
}
paletteByteBuffer.flip();
return paletteByteBuffer.toBuffer();
return paletteBuffer;
}

@@ -210,0 +202,0 @@

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