@emerson-eps/color-tables 0.2.1 → 0.2.4

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.
Files changed (60) hide show
  1. package/dist/component/ColorSelector/ColorSelectorAccordion.d.ts +2 -0
  2. package/dist/component/ColorSelector/{ColorTableSelectorWrapper.js → ColorSelectorAccordion.js} +12 -7
  3. package/dist/component/ColorSelector/ColorSelectorAccordion.js.map +1 -0
  4. package/dist/component/ColorSelector/ColorSelectorComponent.d.ts +12 -3
  5. package/dist/component/ColorSelector/ColorSelectorComponent.js +254 -51
  6. package/dist/component/ColorSelector/ColorSelectorComponent.js.map +1 -1
  7. package/dist/component/ColorSelector/ColorSelectorWrapper.d.ts +8 -0
  8. package/dist/component/ColorSelector/ColorSelectorWrapper.js +64 -0
  9. package/dist/component/ColorSelector/ColorSelectorWrapper.js.map +1 -0
  10. package/dist/component/Legend/ColorLegend.d.ts +13 -0
  11. package/dist/component/Legend/ColorLegend.js +26 -0
  12. package/dist/component/Legend/ColorLegend.js.map +1 -0
  13. package/dist/component/Legend/ContinuousLegend.d.ts +2 -1
  14. package/dist/component/Legend/ContinuousLegend.js +162 -71
  15. package/dist/component/Legend/ContinuousLegend.js.map +1 -1
  16. package/dist/component/Legend/DiscreteLegend.d.ts +3 -1
  17. package/dist/component/Legend/DiscreteLegend.js +132 -57
  18. package/dist/component/Legend/DiscreteLegend.js.map +1 -1
  19. package/dist/component/Utils/discreteLegend.d.ts +1 -1
  20. package/dist/component/Utils/discreteLegend.js +70 -50
  21. package/dist/component/Utils/discreteLegend.js.map +1 -1
  22. package/dist/component/color-tables.json +4 -4
  23. package/dist/stories/ColorLegends/ColorSelector/Selector.stories.d.ts +2 -2
  24. package/dist/stories/ColorLegends/ColorSelector/Selector.stories.js +3 -3
  25. package/dist/stories/ColorLegends/ColorSelector/Selector.stories.js.map +1 -1
  26. package/dist/stories/ColorLegends/DiscreteLegends/Facies.stories.js +11 -11
  27. package/dist/stories/ColorLegends/DiscreteLegends/Facies.stories.js.map +1 -1
  28. package/dist/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.js +1 -1
  29. package/dist/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.js.map +1 -1
  30. package/dist/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.d.ts +7 -0
  31. package/dist/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.js +41 -0
  32. package/dist/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.js.map +1 -0
  33. package/dist/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.d.ts +7 -0
  34. package/dist/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.js +27 -0
  35. package/dist/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.js.map +1 -0
  36. package/dist/stories/ColorLegends/SingleComponent/Single.stories.d.ts +7 -0
  37. package/dist/stories/ColorLegends/SingleComponent/Single.stories.js +47 -0
  38. package/dist/stories/ColorLegends/SingleComponent/Single.stories.js.map +1 -0
  39. package/package.json +3 -3
  40. package/src/component/ColorSelector/{ColorTableSelectorWrapper.tsx → ColorSelectorAccordion.tsx} +11 -6
  41. package/src/component/ColorSelector/ColorSelectorComponent.tsx +308 -93
  42. package/src/component/ColorSelector/ColorSelectorWrapper.tsx +118 -0
  43. package/src/component/Legend/ColorLegend.tsx +81 -0
  44. package/src/component/Legend/ContinuousLegend.tsx +164 -74
  45. package/src/component/Legend/DiscreteLegend.tsx +132 -58
  46. package/src/component/Utils/continousLegend.ts +1 -1
  47. package/src/component/Utils/discreteLegend.ts +77 -52
  48. package/src/component/color-tables.json +4 -4
  49. package/src/stories/ColorLegends/ColorSelector/Selector.stories.jsx +3 -3
  50. package/src/stories/ColorLegends/DiscreteLegends/Facies.stories.jsx +39 -39
  51. package/src/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.jsx +1 -1
  52. package/src/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.jsx +44 -0
  53. package/src/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.jsx +30 -0
  54. package/src/stories/ColorLegends/SingleComponent/Single.stories.jsx +51 -0
  55. package/dist/component/ColorSelector/ColorTableSelectorWrapper.d.ts +0 -2
  56. package/dist/component/ColorSelector/ColorTableSelectorWrapper.js.map +0 -1
  57. package/dist/component/ColorSelector/legendComponent.d.ts +0 -14
  58. package/dist/component/ColorSelector/legendComponent.js +0 -228
  59. package/dist/component/ColorSelector/legendComponent.js.map +0 -1
  60. package/src/component/ColorSelector/legendComponent.tsx +0 -289
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { useRef } from "react";
3
3
  import { RGBToHex, colorsArray } from "../Utils/continousLegend";
4
- import { select, scaleLinear, scaleSequential, axisBottom } from "d3";
4
+ import { select, scaleLinear, scaleSequential, axisBottom, axisRight } from "d3";
5
5
  import { colorTablesArray } from "../ColorTableTypes";
6
6
 
7
7
  declare type legendProps = {
@@ -10,8 +10,9 @@ declare type legendProps = {
10
10
  dataObjectName: string;
11
11
  position?: number[] | null;
12
12
  colorName: string;
13
- colorTables: colorTablesArray;
13
+ colorTables: colorTablesArray | string;
14
14
  horizontal?: boolean | null;
15
+ updateLegend?: any;
15
16
  }
16
17
 
17
18
  declare type ItemColor = {
@@ -27,91 +28,176 @@ export const ContinuousLegend: React.FC<legendProps> = ({
27
28
  colorName,
28
29
  colorTables,
29
30
  horizontal,
31
+ updateLegend,
30
32
  }: legendProps) => {
31
33
  const divRef = useRef<HTMLDivElement>(null);
34
+
32
35
  React.useEffect(() => {
33
36
  if (divRef.current) {
34
37
  continuousLegend();
35
38
  };
36
39
  return function cleanup() {
40
+ select(divRef.current).select("div").remove();
37
41
  select(divRef.current).select("svg").remove();
38
42
  };
39
- }, [min, max, colorName, colorTables, horizontal]);
43
+ }, [min, max, colorName, colorTables, horizontal, updateLegend]);
40
44
 
41
- function continuousLegend() {
45
+ async function continuousLegend() {
42
46
  const itemColor: ItemColor[] = [];
43
- // Return the matched colors array from color.tables.json file
44
- const colorTableColors = colorsArray(colorName, colorTables);
45
- colorTableColors.forEach((value: [number, number, number, number]) => {
46
- // return the color and offset needed to draw the legend
47
- itemColor.push({
48
- offset: RGBToHex(value).offset,
49
- color: RGBToHex(value).color,
47
+ let dataSet;
48
+
49
+ try {
50
+ // fix for dash wrapper
51
+ if (typeof colorTables === "string") {
52
+ let res = await fetch(colorTables);
53
+ dataSet = await res.json()
54
+ }
55
+ // Return the matched colors array from color.tables.json file
56
+ let legendColors = typeof colorTables === "string" ?
57
+ colorsArray(colorName, dataSet)
58
+ :
59
+ colorsArray(colorName, colorTables);
60
+
61
+ // Update color of legend based on color selector scales
62
+ // data is passed on click upon color scales
63
+ if (updateLegend) {
64
+ // legend using color table data
65
+ if (updateLegend.color) {
66
+ legendColors = updateLegend.color;
67
+ }
68
+ // legend using d3 data
69
+ else if (updateLegend.length > 0) {
70
+ legendColors = updateLegend
71
+ }
72
+ }
73
+ // main continuous legend
74
+ else {
75
+ legendColors
76
+ }
77
+
78
+ legendColors.forEach((value: [number, number, number, number]) => {
79
+ // return the color and offset needed to draw the legend
80
+ itemColor.push({
81
+ offset: RGBToHex(value).offset,
82
+ color: RGBToHex(value).color,
83
+ });
50
84
  });
51
- });
52
- const colorScale = scaleSequential().domain([min, max]);
53
- // append a defs (for definition) element to your SVG
54
- const svgLegend = select(divRef.current)
55
- .append("svg")
56
- .style("background-color", "#ffffffcc")
57
- .style("border-radius", "5px");
58
- if (!horizontal) {
85
+
86
+ const colorScale = scaleSequential().domain([min, max]);
87
+ // append a defs (for definition) element to your SVG
88
+ const svgLegend = select(divRef.current)
89
+ .append("svg")
90
+ .style("background-color", "#ffffffcc")
91
+ .style("border-radius", "5px");
92
+
93
+ const defs = svgLegend.append("defs");
94
+ let linearGradient;
95
+ // vertical legend
96
+ if (!horizontal) {
97
+ svgLegend
98
+ // .style("transform", "rotate(270deg)")
99
+ // .style("margin-top", "80px");
100
+ .attr("width", "100")
101
+ .attr("height", "150")
102
+ linearGradient = defs
103
+ .append("linearGradient")
104
+ .attr("id", "linear-gradient")
105
+ .attr("x1", "0%")
106
+ .attr("x2", "0%")
107
+ .attr("y1", "0%")
108
+ .attr("y2", "100%"); //since it's a vertical linear gradient
109
+ }
110
+ // horizontal legend
111
+ else {
112
+ svgLegend
113
+ .attr("width", "220")
114
+ .attr("height", "165")
115
+
116
+ // append a linearGradient element to the defs and give it a unique id
117
+ linearGradient = defs
118
+ .append("linearGradient")
119
+ .attr("id", "linear-gradient")
120
+ .attr("x1", "0%")
121
+ .attr("x2", "100%") //since it's a horizontal linear gradient
122
+ .attr("y1", "0%")
123
+ .attr("y2", "0%");
124
+ }
125
+
126
+ // append multiple color stops by using D3's data/enter step
127
+ linearGradient
128
+ .selectAll("stop")
129
+ .data(itemColor)
130
+ .enter()
131
+ .append("stop")
132
+ .attr("offset", function (data) {
133
+ return data.offset + "%";
134
+ })
135
+ .attr("stop-color", function (data) {
136
+ return data.color;
137
+ });
138
+
139
+ // append title
59
140
  svgLegend
60
- .style("transform", "rotate(270deg)")
61
- .style("margin-top", "80px");
62
- }
63
- const defs = svgLegend.append("defs");
64
- // append a linearGradient element to the defs and give it a unique id
65
- const linearGradient = defs
66
- .append("linearGradient")
67
- .attr("id", "linear-gradient")
68
- .attr("x1", "0%")
69
- .attr("x2", "100%") //since it's a horizontal linear gradient
70
- .attr("y1", "0%")
71
- .attr("y2", "0%");
72
- // append multiple color stops by using D3's data/enter step
73
- linearGradient
74
- .selectAll("stop")
75
- .data(itemColor)
76
- .enter()
77
- .append("stop")
78
- .attr("offset", function (data) {
79
- return data.offset + "%";
80
- })
81
- .attr("stop-color", function (data) {
82
- return data.color;
83
- });
141
+ .append("text")
142
+ .attr("class", "legendTitle")
143
+ .attr("x", 25)
144
+ .attr("y", 20)
145
+ .style("text-anchor", "left")
146
+ .text(dataObjectName);
147
+
148
+ // vertical legend
149
+ if (!horizontal) {
150
+ // draw the rectangle and fill with gradient
151
+ svgLegend
152
+ .append("rect")
153
+ .attr("x", 25)
154
+ .attr("y", 30)
155
+ .attr("width", 25)
156
+ .attr("height", "150")
157
+ .style("fill", "url(#linear-gradient)");
158
+ }
159
+ // horizontal legend
160
+ else {
161
+ // draw the rectangle and fill with gradient
162
+ svgLegend
163
+ .append("rect")
164
+ .attr("x", 25)
165
+ .attr("y", 30)
166
+ .attr("width", "150")
167
+ .attr("height", 25)
168
+ .style("fill", "url(#linear-gradient)");
169
+ }
170
+
171
+ //create tick marks
172
+ // range varies the size of the axis
173
+ const xLeg = scaleLinear().domain([min, max]).range([10, 158]);
174
+ const yLeg = scaleLinear().domain([min, max]).range([10, 127]);
84
175
 
85
- // append title
86
- svgLegend
87
- .append("text")
88
- .attr("class", "legendTitle")
89
- .attr("x", 25)
90
- .attr("y", 20)
91
- .style("text-anchor", "left")
92
- .text(dataObjectName);
93
-
94
- // draw the rectangle and fill with gradient
95
- svgLegend
96
- .append("rect")
97
- .attr("x", 25)
98
- .attr("y", 30)
99
- .attr("width", 250)
100
- .attr("height", 25)
101
- .style("fill", "url(#linear-gradient)");
102
-
103
- //create tick marks
104
- const xLeg = scaleLinear().domain([min, max]).range([10, 258]);
105
-
106
- const axisLeg = axisBottom(xLeg).tickValues(colorScale.domain());
107
-
108
- svgLegend
109
- .attr("class", "axis")
110
- .append("g")
111
- .attr("transform", "translate(15, 55)")
112
- .style("font-size", "10px")
113
- .style("font-weight", "700")
114
- .call(axisLeg);
176
+ const horizontalAxisLeg = axisBottom(xLeg).tickValues(colorScale.domain());
177
+ var VerticalAxisLeg = axisRight(yLeg).tickSize(24).tickValues(colorScale.domain());
178
+
179
+
180
+ if (horizontal) {
181
+ svgLegend
182
+ .attr("class", "axis")
183
+ .append("g")
184
+ .attr("transform", "translate(15, 55)")
185
+ .style("font-size", "10px")
186
+ .style("font-weight", "700")
187
+ .call(horizontalAxisLeg)
188
+ .style("height", 25);
189
+ } else {
190
+ svgLegend
191
+ .attr("class", "axis")
192
+ .append("g")
193
+ .attr("transform", "translate(25, 20)")
194
+ .style("font-size", "10px")
195
+ .style("font-weight", "700")
196
+ .call(VerticalAxisLeg);
197
+ }
198
+ } catch (error) {
199
+ console.error(error);
200
+ }
115
201
  }
116
202
 
117
203
  return (
@@ -122,7 +208,11 @@ export const ContinuousLegend: React.FC<legendProps> = ({
122
208
  top: position ? position[1] : ' ',
123
209
  }}
124
210
  >
125
- <div id="legend" ref={divRef}></div>
211
+ <div id="legend" ref={divRef}
212
+ style={{
213
+ width: horizontal ? "220px" : "100px",
214
+ height: horizontal ? "165px" : "150px",
215
+ }}></div>
126
216
  </div>
127
217
  );
128
218
  };
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { useRef } from "react";
3
- import legendUtil from "../Utils/discreteLegend";
4
- import { scaleOrdinal, select } from "d3";
3
+ import discreteLegendUtil from "../Utils/discreteLegend";
4
+ import { select } from "d3";
5
5
  import { colorTablesArray, colorTablesObj } from "../ColorTableTypes";
6
6
 
7
7
  declare type ItemColor = {
@@ -13,8 +13,9 @@ declare type colorLegendProps = {
13
13
  dataObjectName: string;
14
14
  position?: number[] | null;
15
15
  colorName: string;
16
- colorTables: colorTablesArray;
16
+ colorTables: colorTablesArray | string;
17
17
  horizontal?: boolean | null;
18
+ updateLegend?: any
18
19
  }
19
20
 
20
21
  export const DiscreteColorLegend: React.FC<colorLegendProps> = ({
@@ -24,8 +25,14 @@ export const DiscreteColorLegend: React.FC<colorLegendProps> = ({
24
25
  colorName,
25
26
  colorTables,
26
27
  horizontal,
28
+ updateLegend,
27
29
  }: colorLegendProps) => {
28
30
  const divRef = useRef<HTMLDivElement>(null);
31
+ let itemName: string[] = [];
32
+ let itemColor: ItemColor[] = [];
33
+ let testColor: ItemColor[] = [];
34
+ let testName: string[] = [];
35
+
29
36
  React.useEffect(() => {
30
37
  if (divRef.current) {
31
38
  discreteLegend();
@@ -34,64 +41,121 @@ export const DiscreteColorLegend: React.FC<colorLegendProps> = ({
34
41
  select(divRef.current).select("div").remove();
35
42
  select(divRef.current).select("svg").remove();
36
43
  };
37
- }, [discreteData, colorName, colorTables, horizontal]);
38
- function discreteLegend() {
39
- const itemName: string[] = [];
40
- const itemColor: ItemColor[] = [];
41
- const colorsArray: [number, number, number, number][] = colorTableData(
42
- colorName,
43
- colorTables
44
- );
45
- Object.keys(discreteData).forEach((key) => {
46
- // eslint-disable-next-line
47
- let code = (discreteData as { [key: string]: any })[key][1]
48
- // compare the first value in colorarray(colortable) and code from discreteData
49
- const matchedColorsArrays = colorsArray.find((value: number[]) => {
50
- return value[0] == code;
51
- });
52
- if (matchedColorsArrays)
53
- itemColor.push({
54
- color: RGBToHex(matchedColorsArrays),
44
+ }, [discreteData, colorName, colorTables, horizontal, updateLegend]);
45
+
46
+ async function discreteLegend() {
47
+ let dataSet;
48
+ let discreteFlag = false
49
+
50
+ try {
51
+ // fix for dash wrapper
52
+ if (typeof colorTables === "string") {
53
+ let res = await fetch(colorTables);
54
+ dataSet = await res.json()
55
+ }
56
+
57
+ let colorsArray = typeof colorTables === "string" ?
58
+ colorTableData(colorName, dataSet)
59
+ :
60
+ colorTableData(colorName, colorTables);
61
+
62
+ // Main discrete legend
63
+ if(!updateLegend) {
64
+ Object.keys(discreteData).forEach((key) => {
65
+ //eslint-disable-next-line
66
+ let code = (discreteData as { [key: string]: any })[key][1]
67
+ //compare the first value in colorarray(colortable) and code from discreteData
68
+ const matchedColorsArrays = colorsArray.find((value: number[]) => {
69
+ return value[0] == code;
70
+ });
71
+ if (matchedColorsArrays)
72
+ itemColor.push({color: RGBToHex(matchedColorsArrays)});
73
+ itemName.push(key);
55
74
  });
56
- itemName.push(key);
57
- });
58
-
59
- function RGBToHex(rgb: number[]) {
60
- let r = rgb[1].toString(16),
61
- g = rgb[2].toString(16),
62
- b = rgb[3].toString(16);
63
- if (r.length == 1) r = "0" + r;
64
- if (g.length == 1) g = "0" + g;
65
- if (b.length == 1) b = "0" + b;
66
- return "#" + r + g + b;
67
- }
68
- const ordinalValues = scaleOrdinal().domain(itemName);
69
- const colorLegend = legendUtil(itemColor).inputScale(ordinalValues);
70
- const legendLength = itemColor.length;
71
- const calcLegendHeight = 22 * legendLength + 4 * legendLength;
72
- const selectedLegend = select(divRef.current);
73
- selectedLegend
74
- .append("div")
75
- .text(dataObjectName)
76
- .attr("y", 7)
77
- .style("color", "#6F6F6F")
78
- .style("margin", "10px 10px");
79
- if (horizontal) selectedLegend.style("height", 150 + "px");
80
- const svgLegend = selectedLegend
81
- .append("svg")
82
- .style("margin", "10px 10px")
83
- .call(colorLegend);
84
- if (colorLegend && !horizontal) {
85
- svgLegend
86
- .attr("height", calcLegendHeight + "px")
87
- .attr("width", 220 + "px");
88
- } else {
89
- svgLegend
90
- .style("transform", "rotate(90deg)")
91
- .attr("width", calcLegendHeight + "px")
92
- .attr("height", calcLegendHeight + "px");
75
+ discreteFlag = false
76
+ }
77
+ // Discrete legend using Colortable colors
78
+ else if (updateLegend && updateLegend.color) {
79
+ // Object.keys(discreteData).forEach((key) => {
80
+ // //eslint-disable-next-line
81
+ // let code = (discreteData as { [key: string]: any })[key][1]
82
+ // //compare the first value in colorarray(colortable) and code from discreteData
83
+ // const matchedColorsArrays = updateLegend.color.find((value: number[]) => {
84
+ // return value[0] == code;
85
+ // });
86
+ // if (matchedColorsArrays) {
87
+ // testColor.push({color: RGBToHex(matchedColorsArrays)});
88
+ // testName.push(key);
89
+ // }
90
+
91
+ // });
92
+
93
+ //let color = updateLegend;
94
+ updateLegend.color.forEach((key: any) => {
95
+ testColor.push({color: RGBToHex(key)});
96
+ });
97
+
98
+ itemColor = testColor
99
+ itemName = testName
100
+ discreteFlag = true
101
+ }
102
+ // Discrete legend using d3 colors
103
+ else {
104
+ updateLegend.colorsObject.forEach((key: any) => {
105
+ itemColor.push({color: key});
106
+ });
107
+
108
+ itemColor = itemColor
109
+ itemName = updateLegend.legendColorName
110
+ discreteFlag = true
111
+
112
+ }
113
+
114
+ //const ordinalValues = scaleOrdinal().domain(itemName);
115
+ const colorLegend = discreteLegendUtil(itemColor, discreteFlag)
116
+ const legendLength = itemColor.length;
117
+ const calcLegendHeight = 22 * legendLength + 4 * legendLength;
118
+ const selectedLegend = select(divRef.current);
119
+ selectedLegend
120
+ .append("div")
121
+ .text(dataObjectName)
122
+ .attr("y", 10)
123
+ .style("margin-bottom", "5px")
124
+ if (horizontal && !discreteFlag) selectedLegend.style("height", 150 + "px");
125
+ const svgLegend = selectedLegend
126
+ .style("margin-right", "41px")
127
+ .style("margin-top", "5px")
128
+ .append("svg")
129
+ .call(colorLegend);
130
+ if (colorLegend && !horizontal) {
131
+ svgLegend
132
+ .attr("height", calcLegendHeight + "px")
133
+ .attr("width", 220 + "px");
134
+ } else if (!discreteFlag && horizontal) {
135
+ svgLegend
136
+ .style("transform", "rotate(90deg)")
137
+ .attr("height", calcLegendHeight + "px")
138
+ .attr("width", calcLegendHeight + "px");
139
+ }
140
+ else {
141
+
142
+ var totalRect;
143
+ if (updateLegend.color) {
144
+ totalRect = updateLegend.color.length
145
+ } else {
146
+ totalRect = updateLegend.colorsObject.length
147
+ }
148
+ svgLegend.attr("viewBox", `0 0 ${totalRect} 2`)
149
+ .attr("preserveAspectRatio", "none")
150
+ .style("font-size", ".5")
151
+ .attr("height", "50px")
152
+ .attr("width", "150px");
153
+ }
154
+ } catch (error) {
155
+ console.error(error);
93
156
  }
94
157
  }
158
+
95
159
  return (
96
160
  <div
97
161
  style={{
@@ -119,6 +183,16 @@ export function colorTableData(
119
183
  return colorTableData.length > 0 ? colorTableData[0].colors : [];
120
184
  }
121
185
 
186
+ export function RGBToHex(rgb: number[]) {
187
+ let r = rgb[1].toString(16),
188
+ g = rgb[2].toString(16),
189
+ b = rgb[3].toString(16);
190
+ if (r.length == 1) r = "0" + r;
191
+ if (g.length == 1) g = "0" + g;
192
+ if (b.length == 1) b = "0" + b;
193
+ return "#" + r + g + b;
194
+ }
195
+
122
196
  DiscreteColorLegend.defaultProps = {
123
197
  position: [5, 10],
124
198
  };
@@ -60,7 +60,7 @@ export function rgbValues(
60
60
  }
61
61
 
62
62
  // return the hex color code and offset
63
- export function RGBToHex(rgb: number[]): { color: string; offset: number } {
63
+ export function RGBToHex(rgb: number[]) {
64
64
  let r = Math.round(rgb[1]).toString(16),
65
65
  g = Math.round(rgb[2]).toString(16),
66
66
  b = Math.round(rgb[3]).toString(16);