Skip to content

Commit f8a947b

Browse files
committed
Fix @adobe/leonardo-contrast-colors
1 parent fe99012 commit f8a947b

File tree

3 files changed

+393
-17
lines changed

3 files changed

+393
-17
lines changed

Diff for: package.json

+15
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,20 @@
125125
"packageManager": "[email protected]",
126126
"volta": {
127127
"node": "16.18.1"
128+
},
129+
"pnpm": {
130+
"packageExtensions": {
131+
"@adobe/leonardo-contrast-colors": {
132+
"dependencies": {
133+
"d3": "^5.12.0",
134+
"d3-cam02": "^0.1.5",
135+
"d3-hsluv": "^0.1.2",
136+
"d3-hsv": "^0.1.0"
137+
}
138+
}
139+
},
140+
"patchedDependencies": {
141+
142+
}
128143
}
129144
}

Diff for: patches/@[email protected]

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
diff --git a/backgroundcolor.mjs b/backgroundcolor.mjs
2+
index 69acd17a5c35eb436f79b0a56bf26e8f89be4aa2..06790f68156a06de270c5e165baff6e5ace8858e 100644
3+
--- a/backgroundcolor.mjs
4+
+++ b/backgroundcolor.mjs
5+
@@ -10,9 +10,9 @@ OF ANY KIND, either express or implied. See the License for the specific languag
6+
governing permissions and limitations under the License.
7+
*/
8+
9+
-import { hsluvArray, convertColorValue, createScale, removeDuplicates } from "./utils";
10+
+import { hsluvArray, convertColorValue, createScale, removeDuplicates } from "./utils.mjs";
11+
12+
-import { Color } from "./color";
13+
+import { Color } from "./color.mjs";
14+
15+
class BackgroundColor extends Color {
16+
get backgroundColorScale() {
17+
diff --git a/color.mjs b/color.mjs
18+
index 2a60cf4eb6d7be27b780ae074756f5c7e9e75fa3..0555af9945be890b47548897c9571bfcfe3c0820 100644
19+
--- a/color.mjs
20+
+++ b/color.mjs
21+
@@ -11,7 +11,7 @@ governing permissions and limitations under the License.
22+
*/
23+
24+
import chroma from "chroma-js";
25+
-import { colorSpaces, createScale } from "./utils";
26+
+import { colorSpaces, createScale } from "./utils.mjs";
27+
28+
class Color {
29+
constructor({ name, colorKeys, colorspace = 'RGB', ratios, smooth = false, output = 'HEX', saturation = 100 }) {
30+
diff --git a/index.mjs b/index.mjs
31+
index d2884cd9563c435627ef7213972af578864b1544..09b2b7f8f66f92f984b38970b228a4975518c60f 100644
32+
--- a/index.mjs
33+
+++ b/index.mjs
34+
@@ -11,12 +11,12 @@ governing permissions and limitations under the License.
35+
*/
36+
37+
import chroma from "chroma-js";
38+
-import { extendChroma } from "./chroma-plus";
39+
-import { convertColorValue, createScale, getContrast as contrast, luminance, minPositive, ratioName } from "./utils";
40+
+import { extendChroma } from "./chroma-plus.mjs";
41+
+import { convertColorValue, createScale, getContrast as contrast, luminance, minPositive, ratioName } from "./utils.mjs";
42+
43+
-import { Color } from "./color";
44+
-import { BackgroundColor } from "./backgroundcolor";
45+
-import { Theme } from "./theme";
46+
+import { Color } from "./color.mjs";
47+
+import { BackgroundColor } from "./backgroundcolor.mjs";
48+
+import { Theme } from "./theme.mjs";
49+
50+
extendChroma(chroma);
51+
52+
diff --git a/package.json b/package.json
53+
index 18f901f655cf21204b5f27a33d5fa38085a7f2a2..6e8beece9d16fc4185d11dd8fc48bc83c54ac080 100644
54+
--- a/package.json
55+
+++ b/package.json
56+
@@ -3,11 +3,13 @@
57+
"version": "1.0.0-alpha.16",
58+
"description": "Generate colors based on a desired contrast ratio",
59+
"repository": "[email protected]:adobe/leonardo.git",
60+
- "main": "./index.js",
61+
- "type": "module",
62+
+ "main": "./dist/index.js",
63+
+ "module": "./index.mjs",
64+
+ "type": "commonjs",
65+
"exports": {
66+
".": {
67+
- "default": "./index.js"
68+
+ "import": "./index.mjs",
69+
+ "require": "./dist/index.js"
70+
}
71+
},
72+
"jest": {
73+
@@ -36,6 +38,10 @@
74+
"chroma-js": "^2.4.2",
75+
"ciebase": "^0.1.1",
76+
"ciecam02": "^0.4.6",
77+
+ "d3": "^5.12.0",
78+
+ "d3-cam02": "^0.1.5",
79+
+ "d3-hsluv": "^0.1.2",
80+
+ "d3-hsv": "^0.1.0",
81+
"hsluv": "^0.1.0"
82+
},
83+
"devDependencies": {
84+
diff --git a/theme.mjs b/theme.mjs
85+
index 63911e49bda6c20dbcb96e88b6d9f04056d5ca01..3ec32a5a9846b4bcade53f84ef25b9e0ed73f9e9 100644
86+
--- a/theme.mjs
87+
+++ b/theme.mjs
88+
@@ -12,9 +12,9 @@ governing permissions and limitations under the License.
89+
90+
import chroma from "chroma-js";
91+
92+
-import { colorSpaces, convertColorValue, multiplyRatios, ratioName, round, searchColors } from "./utils";
93+
+import { colorSpaces, convertColorValue, multiplyRatios, ratioName, round, searchColors } from "./utils.mjs";
94+
95+
-import { BackgroundColor } from "./backgroundcolor";
96+
+import { BackgroundColor } from "./backgroundcolor.mjs";
97+
98+
class Theme {
99+
constructor({ colors, backgroundColor, lightness, contrast = 1, saturation = 100, output = 'HEX', formula = 'wcag2' }) {
100+
diff --git a/utils.mjs b/utils.mjs
101+
index 7724bd2bd4bfaf03817e2854ebc67a461f264448..21a427aae31b752ccdb26fa924c3582f2aeee82f 100644
102+
--- a/utils.mjs
103+
+++ b/utils.mjs
104+
@@ -12,7 +12,7 @@ governing permissions and limitations under the License.
105+
106+
import { APCAcontrast, sRGBtoY } from "apca-w3";
107+
import chroma from "chroma-js";
108+
-import { catmullRom2bezier, prepareCurve } from "./curve";
109+
+import { catmullRom2bezier, prepareCurve } from "./curve.mjs";
110+
111+
const colorSpaces = {
112+
CAM02: 'jab',

0 commit comments

Comments
 (0)