@cssints/placeholder 0.1.0 → 0.2.0
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.
- package/dist/index.mjs +3 -3
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -75,8 +75,8 @@ const downsample = (img, w, h) => {
|
|
|
75
75
|
const data = new Uint8Array(w * h * 4);
|
|
76
76
|
for (let cy = 0; cy < h; cy++) {
|
|
77
77
|
const [y0, y1] = span(cy, h, img.height);
|
|
78
|
-
for (
|
|
79
|
-
const [x0, x1] = span(
|
|
78
|
+
for (const mx of Array(w).keys()) {
|
|
79
|
+
const [x0, x1] = span(mx, w, img.width);
|
|
80
80
|
let [r, g, b, a] = [
|
|
81
81
|
0,
|
|
82
82
|
0,
|
|
@@ -91,7 +91,7 @@ const downsample = (img, w, h) => {
|
|
|
91
91
|
b += LINEAR[img.data[i + 2]] * alpha;
|
|
92
92
|
a += alpha;
|
|
93
93
|
}
|
|
94
|
-
const c = (cy * w +
|
|
94
|
+
const c = (cy * w + mx) * 4;
|
|
95
95
|
if (a) data.set([
|
|
96
96
|
toSrgb(r / a),
|
|
97
97
|
toSrgb(g / a),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cssints/placeholder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Image placeholders for cssints: a gradient of the dominant colours, or a thumbhash data URL, read from the image at build time",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"thumbhash": "^0.1.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"cssints": "^0.
|
|
29
|
+
"cssints": "^0.2.0"
|
|
30
30
|
},
|
|
31
31
|
"engines": {
|
|
32
32
|
"node": ">=22"
|