@emerson-eps/color-tables 0.2.19 → 0.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,15 +10,16 @@ export declare function RGBToHex(rgb: number[]): {
10
10
  color: string;
11
11
  offset: number;
12
12
  };
13
- export declare function sampledColor(colorScaleName: string, point: number, categorial?: boolean): number[] | {
13
+ export declare function getColors(colorName: string, colorTables: any, point: number): any;
14
+ export declare function sampledColor(colorScaleName: string, point: number, categorial?: boolean, min?: number, max?: number): number[] | {
14
15
  r: number;
15
16
  g: number;
16
17
  b: number;
17
18
  opacity: number;
18
- } | undefined;
19
- export declare function colorMapFunction(colorScaleName: string): (x: number, categorial: boolean) => number[] | {
19
+ };
20
+ export declare function createColorMapFunction(colorScaleName: string): (x: number, categorial: boolean, min: number, max: number) => number[] | {
20
21
  r: number;
21
22
  g: number;
22
23
  b: number;
23
24
  opacity: number;
24
- } | undefined;
25
+ };
@@ -51,28 +51,52 @@ export function RGBToHex(rgb) {
51
51
  var offset = rgb[0] * 100.0;
52
52
  return { color: "#" + r + g + b, offset: offset };
53
53
  }
54
- export function sampledColor(colorScaleName, point, categorial) {
54
+ export function getColors(colorName, colorTables, point) {
55
+ var colorTableData = colorTables.filter(function (value) {
56
+ return value.name.toLowerCase() == colorName.toLowerCase();
57
+ });
58
+ var colorArrays = colorTableData.find(function (value) {
59
+ return value[0] == point;
60
+ });
61
+ return colorTableData.length > 0 ? colorArrays : [];
62
+ }
63
+ export function sampledColor(colorScaleName, point, categorial, min, max) {
55
64
  var _a, _b;
56
- // colortable colors
57
- var getSelectedScale = colorTables.find(function (value) {
65
+ // get colortable colorscale data
66
+ var getColorTableScale = colorTables.find(function (value) {
58
67
  return value.name == colorScaleName;
59
68
  });
60
- // d3 colors
61
- var d3ColorName = d3ColorScales.find(function (value) {
69
+ // get d3 colorscale data
70
+ var getD3Scale = d3ColorScales.find(function (value) {
62
71
  return value.name == colorScaleName;
63
72
  });
64
73
  var rgb = rgbValues(point, colorScaleName, colorTables);
65
74
  // colortable continuous scale
66
- if ((getSelectedScale === null || getSelectedScale === void 0 ? void 0 : getSelectedScale.discrete) == false) {
67
- return rgb;
75
+ if ((getColorTableScale === null || getColorTableScale === void 0 ? void 0 : getColorTableScale.discrete) == false) {
76
+ // if log is discrete, then need to normalize
77
+ if (categorial) {
78
+ // condition added to resolve typescript error
79
+ //if (min && max) {
80
+ var normalizedPoint = (point - min) / (max - min);
81
+ rgb = rgbValues(normalizedPoint, colorScaleName, colorTables);
82
+ //}
83
+ }
84
+ else {
85
+ rgb = rgbValues(point, colorScaleName, colorTables);
86
+ }
68
87
  }
69
88
  // d3 continuous scale
70
- if (typeof (d3ColorName === null || d3ColorName === void 0 ? void 0 : d3ColorName.colors) == "function") {
71
- var colorMappingRange = d3ColorName === null || d3ColorName === void 0 ? void 0 : d3ColorName.colors(point);
89
+ if (typeof (getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors) == "function") {
90
+ var colorMappingRange = getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors(point);
91
+ // if log is discrete, then need to normalize
92
+ if (categorial) {
93
+ var normalizedPoint = (point - min) / (max - min);
94
+ colorMappingRange = (getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.discrete) == true ? getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors(point) : getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors(normalizedPoint);
95
+ }
72
96
  rgb = (_a = color(colorMappingRange)) === null || _a === void 0 ? void 0 : _a.rgb();
73
97
  }
74
98
  // colortable discrete scale
75
- if ((getSelectedScale === null || getSelectedScale === void 0 ? void 0 : getSelectedScale.discrete) == true) {
99
+ if ((getColorTableScale === null || getColorTableScale === void 0 ? void 0 : getColorTableScale.discrete) == true) {
76
100
  if (categorial) {
77
101
  // compare the code and first value from colorsArray(colortable)
78
102
  var arrayOfColors = colorsArray(colorScaleName, colorTables);
@@ -82,10 +106,10 @@ export function sampledColor(colorScaleName, point, categorial) {
82
106
  rgb = colorArrays;
83
107
  }
84
108
  else {
85
- var getSelectedScaleLength = getSelectedScale === null || getSelectedScale === void 0 ? void 0 : getSelectedScale.colors.length;
109
+ var getSelectedScaleLength = getColorTableScale === null || getColorTableScale === void 0 ? void 0 : getColorTableScale.colors.length;
86
110
  var minValue_1 = 0;
87
111
  var maxValue_1 = getSelectedScaleLength - 1;
88
- getSelectedScale === null || getSelectedScale === void 0 ? void 0 : getSelectedScale.colors.forEach(function (item, index) {
112
+ getColorTableScale === null || getColorTableScale === void 0 ? void 0 : getColorTableScale.colors.forEach(function (item, index) {
89
113
  var _a, _b, _c;
90
114
  var currentIndex = index;
91
115
  var normalizedCurrentIndex = (currentIndex - minValue_1) / (maxValue_1 - minValue_1);
@@ -94,9 +118,9 @@ export function sampledColor(colorScaleName, point, categorial) {
94
118
  //const t = (point - t0) / (t1 - t0); // t = 0.0 gives first color, t = 1.0 gives second color.
95
119
  if (point >= normalizedCurrentIndex &&
96
120
  point <= normalizedNextIndex) {
97
- if ((item && (getSelectedScale === null || getSelectedScale === void 0 ? void 0 : getSelectedScale.colors[nextIndex])) !=
121
+ if ((item && (getColorTableScale === null || getColorTableScale === void 0 ? void 0 : getColorTableScale.colors[nextIndex])) !=
98
122
  undefined) {
99
- var interpolate = interpolateRgb((_a = RGBToHex(item)) === null || _a === void 0 ? void 0 : _a.color, (_b = RGBToHex(getSelectedScale === null || getSelectedScale === void 0 ? void 0 : getSelectedScale.colors[nextIndex])) === null || _b === void 0 ? void 0 : _b.color)(point);
123
+ 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);
100
124
  rgb = (_c = color(interpolate)) === null || _c === void 0 ? void 0 : _c.rgb();
101
125
  }
102
126
  }
@@ -104,16 +128,20 @@ export function sampledColor(colorScaleName, point, categorial) {
104
128
  }
105
129
  }
106
130
  // d3 discrete scale
107
- if (typeof (d3ColorName === null || d3ColorName === void 0 ? void 0 : d3ColorName.colors) == "object") {
131
+ if (typeof (getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors) == "object") {
132
+ // discrete log
108
133
  if (categorial) {
109
- var d3ColorArrays = d3ColorName === null || d3ColorName === void 0 ? void 0 : d3ColorName.colors.find(function (_value, index) {
110
- return index == point;
134
+ var normalizedPoint = (point - min) / (max - min);
135
+ var code_1 = (getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.discrete) == true ? point : normalizedPoint;
136
+ var d3ColorArrays = getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors.find(function (_value, index) {
137
+ return index == code_1;
111
138
  });
112
139
  rgb = (_b = color(d3ColorArrays)) === null || _b === void 0 ? void 0 : _b.rgb();
113
140
  }
141
+ // continous log
114
142
  else {
115
- var max_1 = (d3ColorName === null || d3ColorName === void 0 ? void 0 : d3ColorName.colors.length) - 1;
116
- d3ColorName === null || d3ColorName === void 0 ? void 0 : d3ColorName.colors.forEach(function (item, index) {
143
+ var max_1 = (getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors.length) - 1;
144
+ getD3Scale === null || getD3Scale === void 0 ? void 0 : getD3Scale.colors.forEach(function (item, index) {
117
145
  var _a;
118
146
  var currentIndex = index;
119
147
  var normalizedCurrentIndex = (currentIndex - 0) / (max_1 - 0);
@@ -122,7 +150,7 @@ export function sampledColor(colorScaleName, point, categorial) {
122
150
  //const t = (point - t0) / (t1 - t0); // t = 0.0 gives first color, t = 1.0 gives second color.
123
151
  if (point >= normalizedCurrentIndex &&
124
152
  point <= normalizedNextIndex) {
125
- var interpolate = interpolateRgb(item, d3ColorName[nextIndex])(point);
153
+ var interpolate = interpolateRgb(item, getD3Scale[nextIndex])(point);
126
154
  rgb = (_a = color(interpolate)) === null || _a === void 0 ? void 0 : _a.rgb();
127
155
  }
128
156
  });
@@ -130,9 +158,9 @@ export function sampledColor(colorScaleName, point, categorial) {
130
158
  }
131
159
  return rgb;
132
160
  }
133
- export function colorMapFunction(colorScaleName) {
134
- return function (x, categorial) {
135
- return sampledColor(colorScaleName, x, categorial);
161
+ export function createColorMapFunction(colorScaleName) {
162
+ return function (x, categorial, min, max) {
163
+ return sampledColor(colorScaleName, x, categorial, min, max);
136
164
  };
137
165
  }
138
166
  //# sourceMappingURL=legendCommonFunction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"legendCommonFunction.js","sourceRoot":"","sources":["../../../src/component/Utils/legendCommonFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKhD,OAAO,WAAW,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,0EAA0E;AAC1E,MAAM,UAAU,WAAW,CACvB,SAAiB,EACjB,WAAgB;IAEhB,IAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CACrC,UAAC,KAAqB;QAClB,OAAA,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,SAAS,CAAC,WAAW,EAAE;IAAnD,CAAmD,CAC1D,CAAC;IACF,OAAO,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AACrE,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,SAAS,CACrB,KAAa,EACb,SAAiB,EACjB,WAAmC;;IAEnC,IAAM,gBAAgB,GAAG,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC7D,0DAA0D;IAC1D,IAAM,WAAW,GAAG,gBAAgB,CAAC,IAAI,CACrC,UAAC,KAAuC;QACpC,OAAO,KAAK,IAAI,KAAK,CAA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C,CAAC,CAAC;gBAC9D,IAAM,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;gBAC5B,IAAM,mBAAmB,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,KAAG,GAAG,CAAC,CAAC,CAAC;gBACxD,+FAA+F;gBAC/F,IACI,KAAK,IAAI,sBAAsB;oBAC/B,KAAK,IAAI,mBAAmB,EAC9B;oBACE,IAAM,WAAW,GAAG,cAAc,CAC9B,IAAI,EACJ,WAAW,CAAC,SAAS,CAAC,CACzB,CAAC,KAAK,CAAC,CAAC;oBACT,GAAG,GAAG,MAAA,KAAK,CAAC,WAAW,CAAC,0CAAE,GAAG,EAAE,CAAC;iBACnC;YACL,CAAC,CAAC,CAAC;SACN;KACJ;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,cAAsB;IACnD,OAAO,UAAC,CAAS,EAAE,UAAmB;QAClC,OAAO,YAAY,CAAC,cAAc,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"legendCommonFunction.js","sourceRoot":"","sources":["../../../src/component/Utils/legendCommonFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKhD,OAAO,WAAW,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,0EAA0E;AAC1E,MAAM,UAAU,WAAW,CACvB,SAAiB,EACjB,WAAgB;IAEhB,IAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CACrC,UAAC,KAAqB;QAClB,OAAA,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,SAAS,CAAC,WAAW,EAAE;IAAnD,CAAmD,CAC1D,CAAC;IACF,OAAO,cAAc,CAAC,MAAM,GAAG,CAAC,C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E,UAAU,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACjE,CAAC,CAAC;AACN,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { ColorSelectorAccordion } from './component/ColorSelector/ColorSelectorAccordion';
2
2
  import { ColorLegend } from './component/Legend/ColorLegend';
3
- import { colorsArray, rgbValues, RGBToHex } from './component/Utils/legendCommonFunction';
3
+ import { colorsArray, rgbValues, RGBToHex, createColorMapFunction, getColors } from './component/Utils/legendCommonFunction';
4
4
  import { d3ColorScales } from './component/Utils/d3ColorScale';
5
5
  import { colorTablesObj, colorTablesArray } from './component/colorTableTypes';
6
6
  import { ContinuousLegend } from './component/Legend/ContinuousLegend';
7
7
  import { DiscreteColorLegend } from './component/Legend/DiscreteLegend';
8
8
  import * as colorTables from './component/color-tables.json';
9
- export { ColorSelectorAccordion, ContinuousLegend, DiscreteColorLegend, ColorLegend, colorsArray, rgbValues, RGBToHex, d3ColorScales, colorTablesObj, colorTablesArray, colorTables, };
9
+ export { ColorSelectorAccordion, ContinuousLegend, DiscreteColorLegend, ColorLegend, colorsArray, rgbValues, RGBToHex, createColorMapFunction, getColors, d3ColorScales, colorTablesObj, colorTablesArray, colorTables, };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { ColorSelectorAccordion } from './component/ColorSelector/ColorSelectorAccordion';
2
2
  import { ColorLegend } from './component/Legend/ColorLegend';
3
- import { colorsArray, rgbValues, RGBToHex } from './component/Utils/legendCommonFunction';
3
+ import { colorsArray, rgbValues, RGBToHex, createColorMapFunction, getColors } from './component/Utils/legendCommonFunction';
4
4
  import { d3ColorScales } from './component/Utils/d3ColorScale';
5
5
  import { ContinuousLegend } from './component/Legend/ContinuousLegend';
6
6
  import { DiscreteColorLegend } from './component/Legend/DiscreteLegend';
7
7
  import * as colorTables from './component/color-tables.json';
8
- export { ColorSelectorAccordion, ContinuousLegend, DiscreteColorLegend, ColorLegend, colorsArray, rgbValues, RGBToHex, d3ColorScales, colorTables, };
8
+ export { ColorSelectorAccordion, ContinuousLegend, DiscreteColorLegend, ColorLegend, colorsArray, rgbValues, RGBToHex, createColorMapFunction, getColors, d3ColorScales, colorTables, };
9
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,EACR,aAAa,EAGb,WAAW,GACd,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAC7H,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,EACR,sBAAsB,EACtB,SAAS,EACT,aAAa,EAGb,WAAW,GACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emerson-eps/color-tables",
3
- "version": "0.2.19",
3
+ "version": "0.2.22",
4
4
  "description": "Standard library of color tables for geological domain",
5
5
  "release": {
6
6
  "branches": [