-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
393 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,5 +125,20 @@ | |
"packageManager": "[email protected]", | ||
"volta": { | ||
"node": "16.18.1" | ||
}, | ||
"pnpm": { | ||
"packageExtensions": { | ||
"@adobe/leonardo-contrast-colors": { | ||
"dependencies": { | ||
"d3": "^5.12.0", | ||
"d3-cam02": "^0.1.5", | ||
"d3-hsluv": "^0.1.2", | ||
"d3-hsv": "^0.1.0" | ||
} | ||
} | ||
}, | ||
"patchedDependencies": { | ||
"@adobe/[email protected]": "patches/@[email protected]" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
diff --git a/backgroundcolor.mjs b/backgroundcolor.mjs | ||
index 69acd17a5c35eb436f79b0a56bf26e8f89be4aa2..06790f68156a06de270c5e165baff6e5ace8858e 100644 | ||
--- a/backgroundcolor.mjs | ||
+++ b/backgroundcolor.mjs | ||
@@ -10,9 +10,9 @@ OF ANY KIND, either express or implied. See the License for the specific languag | ||
governing permissions and limitations under the License. | ||
*/ | ||
|
||
-import { hsluvArray, convertColorValue, createScale, removeDuplicates } from "./utils"; | ||
+import { hsluvArray, convertColorValue, createScale, removeDuplicates } from "./utils.mjs"; | ||
|
||
-import { Color } from "./color"; | ||
+import { Color } from "./color.mjs"; | ||
|
||
class BackgroundColor extends Color { | ||
get backgroundColorScale() { | ||
diff --git a/color.mjs b/color.mjs | ||
index 2a60cf4eb6d7be27b780ae074756f5c7e9e75fa3..0555af9945be890b47548897c9571bfcfe3c0820 100644 | ||
--- a/color.mjs | ||
+++ b/color.mjs | ||
@@ -11,7 +11,7 @@ governing permissions and limitations under the License. | ||
*/ | ||
|
||
import chroma from "chroma-js"; | ||
-import { colorSpaces, createScale } from "./utils"; | ||
+import { colorSpaces, createScale } from "./utils.mjs"; | ||
|
||
class Color { | ||
constructor({ name, colorKeys, colorspace = 'RGB', ratios, smooth = false, output = 'HEX', saturation = 100 }) { | ||
diff --git a/index.mjs b/index.mjs | ||
index d2884cd9563c435627ef7213972af578864b1544..09b2b7f8f66f92f984b38970b228a4975518c60f 100644 | ||
--- a/index.mjs | ||
+++ b/index.mjs | ||
@@ -11,12 +11,12 @@ governing permissions and limitations under the License. | ||
*/ | ||
|
||
import chroma from "chroma-js"; | ||
-import { extendChroma } from "./chroma-plus"; | ||
-import { convertColorValue, createScale, getContrast as contrast, luminance, minPositive, ratioName } from "./utils"; | ||
+import { extendChroma } from "./chroma-plus.mjs"; | ||
+import { convertColorValue, createScale, getContrast as contrast, luminance, minPositive, ratioName } from "./utils.mjs"; | ||
|
||
-import { Color } from "./color"; | ||
-import { BackgroundColor } from "./backgroundcolor"; | ||
-import { Theme } from "./theme"; | ||
+import { Color } from "./color.mjs"; | ||
+import { BackgroundColor } from "./backgroundcolor.mjs"; | ||
+import { Theme } from "./theme.mjs"; | ||
|
||
extendChroma(chroma); | ||
|
||
diff --git a/package.json b/package.json | ||
index 18f901f655cf21204b5f27a33d5fa38085a7f2a2..6e8beece9d16fc4185d11dd8fc48bc83c54ac080 100644 | ||
--- a/package.json | ||
+++ b/package.json | ||
@@ -3,11 +3,13 @@ | ||
"version": "1.0.0-alpha.16", | ||
"description": "Generate colors based on a desired contrast ratio", | ||
"repository": "[email protected]:adobe/leonardo.git", | ||
- "main": "./index.js", | ||
- "type": "module", | ||
+ "main": "./dist/index.js", | ||
+ "module": "./index.mjs", | ||
+ "type": "commonjs", | ||
"exports": { | ||
".": { | ||
- "default": "./index.js" | ||
+ "import": "./index.mjs", | ||
+ "require": "./dist/index.js" | ||
} | ||
}, | ||
"jest": { | ||
@@ -36,6 +38,10 @@ | ||
"chroma-js": "^2.4.2", | ||
"ciebase": "^0.1.1", | ||
"ciecam02": "^0.4.6", | ||
+ "d3": "^5.12.0", | ||
+ "d3-cam02": "^0.1.5", | ||
+ "d3-hsluv": "^0.1.2", | ||
+ "d3-hsv": "^0.1.0", | ||
"hsluv": "^0.1.0" | ||
}, | ||
"devDependencies": { | ||
diff --git a/theme.mjs b/theme.mjs | ||
index 63911e49bda6c20dbcb96e88b6d9f04056d5ca01..3ec32a5a9846b4bcade53f84ef25b9e0ed73f9e9 100644 | ||
--- a/theme.mjs | ||
+++ b/theme.mjs | ||
@@ -12,9 +12,9 @@ governing permissions and limitations under the License. | ||
|
||
import chroma from "chroma-js"; | ||
|
||
-import { colorSpaces, convertColorValue, multiplyRatios, ratioName, round, searchColors } from "./utils"; | ||
+import { colorSpaces, convertColorValue, multiplyRatios, ratioName, round, searchColors } from "./utils.mjs"; | ||
|
||
-import { BackgroundColor } from "./backgroundcolor"; | ||
+import { BackgroundColor } from "./backgroundcolor.mjs"; | ||
|
||
class Theme { | ||
constructor({ colors, backgroundColor, lightness, contrast = 1, saturation = 100, output = 'HEX', formula = 'wcag2' }) { | ||
diff --git a/utils.mjs b/utils.mjs | ||
index 7724bd2bd4bfaf03817e2854ebc67a461f264448..21a427aae31b752ccdb26fa924c3582f2aeee82f 100644 | ||
--- a/utils.mjs | ||
+++ b/utils.mjs | ||
@@ -12,7 +12,7 @@ governing permissions and limitations under the License. | ||
|
||
import { APCAcontrast, sRGBtoY } from "apca-w3"; | ||
import chroma from "chroma-js"; | ||
-import { catmullRom2bezier, prepareCurve } from "./curve"; | ||
+import { catmullRom2bezier, prepareCurve } from "./curve.mjs"; | ||
|
||
const colorSpaces = { | ||
CAM02: 'jab', |
Oops, something went wrong.