Create new method `resolveColorFilter()`

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
This commit is contained in:
Phillip Rak 2025-09-29 15:21:40 -07:00
parent aa3856ee69
commit 0249d9ec9e
1 changed files with 14 additions and 0 deletions

View File

@ -75,6 +75,20 @@ export default {
return normalizeHex(mapStandardColors(value ?? fallback));
},
resolveColorFilter(cacheKey, rgb) {
if (filterCache[cacheKey]) {
return filterCache[cacheKey];
}
const solver = new Solver(rgb);
const res = solver.solve();
const filter = res?.filter;
filterCache[cacheKey] = filter;
return filter;
},
setColor() {
const colorConfig = colors[this.color];
const uiColor = this.getComputedStyleFor(colorConfig.color, colorConfig.colorFallback);