colorjs.io
Advanced tools
Comparing version 0.4.0 to 0.4.1-patch.1
{ | ||
"name": "colorjs.io", | ||
"version": "0.4.0", | ||
"version": "0.4.1-patch.1", | ||
"description": "Let’s get serious about color", | ||
@@ -10,14 +10,34 @@ "files": [ | ||
"dist/color.js.map", | ||
"src/" | ||
"dist/color.legacy.cjs", | ||
"dist/color.legacy.cjs.map", | ||
"dist/color.legacy.js", | ||
"dist/color.legacy.js.map", | ||
"src/", | ||
"types/dist/", | ||
"types/src/", | ||
"types/index.d.ts" | ||
], | ||
"exports": { | ||
".": { | ||
"types": "./types/index.d.ts", | ||
"import": "./dist/color.js", | ||
"require": "./dist/color.cjs" | ||
}, | ||
"./fn": "./src/index-fn.js" | ||
"./fn": { | ||
"types": "./types/src/index-fn.d.ts", | ||
"import": "./src/index-fn.js" | ||
}, | ||
"./dist/*": "./dist/*" | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"fn": [ | ||
"./types/src/index-fn.d.ts" | ||
] | ||
} | ||
}, | ||
"type": "module", | ||
"main": "./dist/color.cjs", | ||
"module": "./dist/color.js", | ||
"types": "./types", | ||
"directories": { | ||
@@ -28,10 +48,13 @@ "test": "tests" | ||
"test": "open tests/", | ||
"dtslint": "dtslint types", | ||
"build:css": "npx postcss \"**/*.postcss\" --base . --dir . --ext .css --config postcss.config.cjs", | ||
"build:html": "npx @11ty/eleventy --config=.eleventy.cjs", | ||
"build:js": "rollup -c", | ||
"build": "npm run build:html && npm run build:css && npm run build:js", | ||
"build:js:legacy": "rollup -c rollup.legacy.config.js", | ||
"build": "npm run build:html && npm run build:css && npm run build:js && npm run build:js:legacy", | ||
"watch:css": "npx postcss \"**/*.postcss\" --base . --dir . --ext .css --config postcss.config.cjs --watch", | ||
"watch:html": "npx @11ty/eleventy --config=.eleventy.cjs --watch", | ||
"watch:js": "rollup -c --watch", | ||
"watch": "npm run watch:css & npm run watch:html & npm run watch:js" | ||
"watch": "npm run watch:css & npm run watch:html & npm run watch:js", | ||
"prepack": "npm run build" | ||
}, | ||
@@ -45,3 +68,6 @@ "repository": { | ||
], | ||
"contributors": ["Lea Verou", "Chris Lilley"], | ||
"contributors": [ | ||
"Lea Verou", | ||
"Chris Lilley" | ||
], | ||
"license": "MIT", | ||
@@ -54,3 +80,11 @@ "bugs": { | ||
"@11ty/eleventy": "^1.0", | ||
"@babel/core": "^7.19.3", | ||
"@babel/preset-env": "^7.19.3", | ||
"@definitelytyped/dtslint": "latest", | ||
"@rollup/plugin-babel": "^5.3.1", | ||
"@rollup/plugin-commonjs": "^22.0.2", | ||
"@rollup/plugin-node-resolve": "^14.1.0", | ||
"@typescript-eslint/parser": "^5.40.0", | ||
"acorn": "latest", | ||
"core-js": "^3.25.3", | ||
"eslint": "latest", | ||
@@ -62,3 +96,4 @@ "markdown-it": "latest", | ||
"rollup": "^2.10", | ||
"rollup-plugin-terser": "^7" | ||
"rollup-plugin-terser": "^7", | ||
"typescript": "^4.8.4" | ||
}, | ||
@@ -65,0 +100,0 @@ "sideEffects": [ |
@@ -70,2 +70,4 @@ // APCA 0.0.98G | ||
// why is this a delta, when Y is not perceptually uniform? | ||
// Answer: it is a noise gate, see | ||
// https://github.com/LeaVerou/color.js/issues/208 | ||
if (Math.abs(Ybg - Ytxt) < deltaYmin) { | ||
@@ -72,0 +74,0 @@ C = 0; |
@@ -5,2 +5,3 @@ export {default as contrastWCAG21} from "./WCAG21.js"; | ||
export {default as contrastWeber} from "./Weber.js"; | ||
export {default as contrastLstar} from "./Lstar.js"; | ||
export {default as contrastLstar} from "./Lstar.js"; | ||
export {default as contrastDeltaPhi} from "./deltaPhi.js"; |
@@ -9,2 +9,8 @@ // Weber luminance contrast | ||
// the darkest sRGB color above black is #000001 and this produces | ||
// a plain Weber contrast of ~45647. | ||
// So, setting the divide-by-zero result at 50000 is a reasonable | ||
// max clamp for the plain Weber | ||
const max = 50000; | ||
export default function contrastWeber (color1, color2) { | ||
@@ -21,3 +27,3 @@ color1 = getColor(color1); | ||
return Y2 === 0 ? 0 : (Y1 - Y2) / Y2; | ||
}; | ||
return Y2 === 0 ? max : (Y1 - Y2) / Y2; | ||
}; |
@@ -35,5 +35,5 @@ /** | ||
let {space, outputSpace} = o; | ||
let {space, outputSpace, premultiplied} = o; | ||
let r = range(c1, c2, {space, outputSpace}); | ||
let r = range(c1, c2, {space, outputSpace, premultiplied}); | ||
return r(p); | ||
@@ -40,0 +40,0 @@ } |
export {default as XYZ_D65} from "./xyz-d65.js"; | ||
export {default as XYZ_D50} from "./xyz-d50.js"; | ||
export {default as XYZ_ABS_D65} from "./xyz-abs-d65.js"; | ||
export {default as Lab_D65} from "./lab-d65.js"; | ||
export {default as Lab} from "./lab.js"; | ||
@@ -5,0 +6,0 @@ export {default as LCH} from "./lch.js"; |
@@ -71,5 +71,5 @@ import ColorSpace from "../space.js"; | ||
"lab": { | ||
coords: ["<percentage> | <number>", "<number>", "<number>"], | ||
coords: ["<number> | <percentage>", "<number>", "<number>"], | ||
} | ||
} | ||
}); |
@@ -64,5 +64,5 @@ import ColorSpace from "../space.js"; | ||
"lch": { | ||
coords: ["<percentage> | <number>", "<number>", "<number> | <angle>"], | ||
coords: ["<number> | <percentage>", "<number>", "<number> | <angle>"], | ||
} | ||
} | ||
}); |
@@ -71,5 +71,5 @@ import ColorSpace from "../space.js"; | ||
"oklab": { | ||
coords: ["<percentage>", "<number>", "<number>"], | ||
coords: ["<number> | <percentage>", "<number>", "<number>"], | ||
} | ||
} | ||
}); |
@@ -65,3 +65,3 @@ import ColorSpace from "../space.js"; | ||
"oklch": { | ||
coords: ["<percentage>", "<number>", "<number> | <angle>"], | ||
coords: ["<number> | <percentage>", "<number>", "<number> | <angle>"], | ||
} | ||
@@ -68,0 +68,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1894732
170
20759
18