aplayer-react
Advanced tools
Comparing version 1.0.0-alpha.11 to 1.0.0-alpha.12
@@ -742,13 +742,10 @@ "use strict"; | ||
// src/utils/getImageColor.ts | ||
var import_colorthief = __toESM(require("@pioug/colorthief")); | ||
var colorThiefSingleton; | ||
var import_fast_average_color = require("fast-average-color"); | ||
var facSingleton; | ||
function getImageColor(imageUrl) { | ||
const colorThief = colorThiefSingleton ?? (colorThiefSingleton = new import_colorthief.default()); | ||
return new Promise((resolve) => { | ||
const img = new Image(); | ||
img.onload = () => { | ||
resolve(colorThief.getColor(img)); | ||
}; | ||
img.crossOrigin = "anonymous"; | ||
img.src = imageUrl; | ||
const fac = facSingleton ?? (facSingleton = new import_fast_average_color.FastAverageColor()); | ||
return fac.getColorAsync(imageUrl, { | ||
ignoredColor: [255, 255, 255, 255] | ||
}).then((color) => { | ||
return color.hex; | ||
}); | ||
@@ -770,6 +767,6 @@ } | ||
const coverUrl = song.cover; | ||
getImageColor(coverUrl).then(([r, g, b]) => { | ||
getImageColor(coverUrl).then((hex) => { | ||
setCoverColorMap((prev) => ({ | ||
...prev, | ||
[coverUrl]: `rgb(${r},${g},${b})` | ||
[coverUrl]: hex | ||
})); | ||
@@ -776,0 +773,0 @@ }); |
{ | ||
"name": "aplayer-react", | ||
"version": "1.0.0-alpha.11", | ||
"version": "1.0.0-alpha.12", | ||
"description": "The missing APlayer for React applications", | ||
@@ -53,6 +53,6 @@ "publishConfig": { | ||
"dependencies": { | ||
"@pioug/colorthief": "^3.0.1", | ||
"clsx": "^1.2.1", | ||
"fast-average-color": "^9.3.0", | ||
"use-sync-external-store": "^1.2.0" | ||
} | ||
} |
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
72089
1811
+ Addedfast-average-color@^9.3.0
+ Addedfast-average-color@9.4.0(transitive)
- Removed@pioug/colorthief@^3.0.1
- Removed@pioug/colorthief@3.0.1(transitive)
- Removed@pioug/get-pixels@4.0.0(transitive)
- Removed@pioug/quantize@1.2.0(transitive)
- Removedcwise-compiler@1.1.3(transitive)
- Removeddata-uri-to-buffer@0.0.3(transitive)
- Removediota-array@1.0.0(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedjpeg-js@0.4.4(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedndarray@1.0.19(transitive)
- Removedndarray-pack@1.2.1(transitive)
- Removednode-bitmap@0.0.1(transitive)
- Removedomggif@1.0.10(transitive)
- Removedpngjs@3.4.0(transitive)
- Removedthrough@2.3.8(transitive)
- Removeduniq@1.0.1(transitive)