screenshot-beautify 1.3.0 → 1.3.1
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.js +32 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -99,16 +99,38 @@ async function extractDominantColor(imagePath) {
|
|
|
99
99
|
const isNeutral = avgSaturation < 25 || hsl.s < 15 || isGreyish;
|
|
100
100
|
let color1Hsl, color2Hsl;
|
|
101
101
|
if (isNeutral) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
const vibrantPairs = [
|
|
103
|
+
["#667eea", "#764ba2"],
|
|
104
|
+
// indigo → purple
|
|
105
|
+
["#f093fb", "#f5576c"],
|
|
106
|
+
// pink → coral
|
|
107
|
+
["#43e97b", "#38f9d7"],
|
|
108
|
+
// emerald → cyan
|
|
109
|
+
["#00c6fb", "#005bea"],
|
|
110
|
+
// sky → deep blue
|
|
111
|
+
["#e0c3fc", "#8ec5fc"],
|
|
112
|
+
// lavender → sky blue
|
|
113
|
+
["#ff9a9e", "#fad0c4"],
|
|
114
|
+
// salmon → peach
|
|
115
|
+
["#f12711", "#f5af19"],
|
|
116
|
+
// red → amber
|
|
117
|
+
["#d4fc79", "#96e6a1"],
|
|
118
|
+
// lime → mint
|
|
119
|
+
["#eecda3", "#ef629f"],
|
|
120
|
+
// gold → rose
|
|
121
|
+
["#fc00ff", "#00dbde"],
|
|
122
|
+
// magenta → teal
|
|
123
|
+
["#a1c4fd", "#c2e9fb"],
|
|
124
|
+
// periwinkle → ice blue
|
|
125
|
+
["#ffecd2", "#fcb69f"]
|
|
126
|
+
// cream → peach
|
|
127
|
+
];
|
|
128
|
+
let hash = 0;
|
|
129
|
+
for (let i = 0; i < data.length; i += info.channels * 3) {
|
|
130
|
+
hash = (hash << 5) - hash + data[i] | 0;
|
|
131
|
+
}
|
|
132
|
+
const index = Math.abs(hash) % vibrantPairs.length;
|
|
133
|
+
return vibrantPairs[index];
|
|
112
134
|
} else {
|
|
113
135
|
color1Hsl = {
|
|
114
136
|
h: hsl.h,
|