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

@emerson-eps/color-tables

Package Overview
Dependencies
Maintainers
2
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@emerson-eps/color-tables - npm Package Compare versions

Comparing version 0.2.41 to 0.3.0

dist/component/Utils/legendCommonFunction.stories.d.ts

24

dist/component/Utils/legendCommonFunction.d.ts
import { colorTablesArray } from "../colorTableTypes";
declare type Color = [number, number, number];
export declare function colorsArray(colorName: string, iscolorTablesDefined: colorTablesArray | any): any;
export declare function rgbValues(point: number, colorName: string, iscolorTablesDefined: colorTablesArray | any): number[] | {
r: number;
g: number;
b: number;
opacity: number;
} | undefined;
export declare function rgbValues(point: number, colorName: string, iscolorTablesDefined: colorTablesArray | any): Color;
export declare function RGBToHex(rgb: number[]): {

@@ -24,13 +20,5 @@ color: string;

export declare function getColors(colorName: string, iscolorTablesDefined: any, point: number): any;
export declare function sampledColor(colorScaleName: string, point: number, categorial?: boolean, min?: number, max?: number, iscolorTablesDefined?: colorTablesArray | any): number[] | {
r: number;
g: number;
b: number;
opacity: number;
};
export declare function createColorMapFunction(colorScaleName: string): (x: number, categorial: boolean, min: number, max: number, iscolorTablesDefined: colorTablesArray | any) => number[] | {
r: number;
g: number;
b: number;
opacity: number;
};
export declare function sampledColor(colorScaleName: string, point: number, categorial?: boolean, min?: number, max?: number, iscolorTablesDefined?: colorTablesArray | any): [number, number, number, number] | Color;
export declare function createColorMapFunction(colorScaleName: string): (x: number, categorial?: boolean, min?: number, max?: number, iscolorTablesDefined?: colorTablesArray | any) => [number, number, number, number] | Color;
export declare function createContinuousLibraryColorScale(name: string, library?: colorTablesArray): (value: number) => Color;
export {};

@@ -5,2 +5,5 @@ import { color } from "d3-color";

import colorTables from "../../component/color-tables.json";
function getColor(rgb) {
return [rgb["r"], rgb["g"], rgb["b"]];
}
// Based on objectName return the colors array from color.tables.json file

@@ -12,3 +15,3 @@ export function colorsArray(colorName, iscolorTablesDefined) {

var colorTableData = getColorTables.filter(function (value) {
return value.name.toLowerCase() == colorName.toLowerCase();
return value.name.toLowerCase() === colorName.toLowerCase();
});

@@ -26,3 +29,3 @@ return colorTableData.length > 0 ? colorTableData[0].colors : [];

var colorArrays = colorTableColors.find(function (value) {
return point == value[0];
return point === value[0];
});

@@ -41,3 +44,3 @@ // if point and value in color table matches then return particular colors

var secondColorArray = colorTableColors[index];
if ((firstColorArray || secondColorArray) != undefined) {
if ((firstColorArray || secondColorArray) !== undefined) {
var t0 = firstColorArray[0];

@@ -47,3 +50,4 @@ var t1 = secondColorArray[0];

var interpolatedValues = interpolateRgb(RGBToHex(firstColorArray).color, RGBToHex(secondColorArray).color)(t);
return (_a = color(interpolatedValues)) === null || _a === void 0 ? void 0 : _a.rgb();
var c = (_a = color(interpolatedValues)) === null || _a === void 0 ? void 0 : _a.rgb();
return getColor(c);
}

@@ -191,3 +195,3 @@ return undefined;

}
rgb = (_a = color(colorMappingRange)) === null || _a === void 0 ? void 0 : _a.rgb();
rgb = getColor((_a = color(colorMappingRange)) === null || _a === void 0 ? void 0 : _a.rgb());
}

@@ -202,3 +206,3 @@ // colortable discrete scale

});
rgb = colorArrays;
return colorArrays;
}

@@ -219,3 +223,3 @@ else {

var interpolate = interpolateRgb((_a = RGBToHex(item)) === null || _a === void 0 ? void 0 : _a.color, (_b = RGBToHex(getColorTableScale === null || getColorTableScale === void 0 ? void 0 : getColorTableScale.colors[nextIndex])) === null || _b === void 0 ? void 0 : _b.color)(point);
rgb = (_c = color(interpolate)) === null || _c === void 0 ? void 0 : _c.rgb();
rgb = getColor((_c = color(interpolate)) === null || _c === void 0 ? void 0 : _c.rgb());
}

@@ -235,3 +239,3 @@ }

});
rgb = (_b = color(d3ColorArrays)) === null || _b === void 0 ? void 0 : _b.rgb();
rgb = getColor((_b = color(d3ColorArrays)) === null || _b === void 0 ? void 0 : _b.rgb());
}

@@ -250,3 +254,3 @@ // continous log

var interpolate = interpolateRgb(item, getD3Scale[nextIndex])(point);
rgb = (_a = color(interpolate)) === null || _a === void 0 ? void 0 : _a.rgb();
rgb = getColor((_a = color(interpolate)) === null || _a === void 0 ? void 0 : _a.rgb());
}

@@ -260,5 +264,15 @@ });

return function (x, categorial, min, max, iscolorTablesDefined) {
if (categorial === void 0) { categorial = false; }
if (min === void 0) { min = 0; }
if (max === void 0) { max = 1; }
if (iscolorTablesDefined === void 0) { iscolorTablesDefined = colorTables; }
return sampledColor(colorScaleName, x, categorial, min, max, iscolorTablesDefined);
};
}
export function createContinuousLibraryColorScale(name, library) {
if (library === void 0) { library = colorTables; }
return function (value) {
return rgbValues(value, name, library);
};
}
//# sourceMappingURL=legendCommonFunction.js.map
{
"name": "@emerson-eps/color-tables",
"version": "0.2.41",
"version": "0.3.0",
"description": "Standard library of color tables for geological domain",

@@ -5,0 +5,0 @@ "release": {

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