MCPcopy Create free account
hub / github.com/error311/FileRise / applyFolderColorToOption

Function applyFolderColorToOption

public/js/folderManager.js:1220–1242  ·  view source on GitHub ↗
(folder, hex)

Source from the content-addressed store, hash-verified

1218}
1219
1220function applyFolderColorToOption(folder, hex) {
1221 // accepts folder like "root" or "A/B"
1222 const sel = folder === 'root'
1223 ? '#rootRow .folder-option'
1224 : `.folder-option[data-folder="${CSS.escape(folder)}"]`;
1225 const el = document.querySelector(sel);
1226 if (!el) return;
1227
1228 if (!hex) {
1229 el.style.removeProperty('--filr-folder-front');
1230 el.style.removeProperty('--filr-folder-back');
1231 el.style.removeProperty('--filr-folder-stroke');
1232 return;
1233 }
1234
1235 const front = hex; // main
1236 const back = lighten(hex, 14); // body (slightly lighter)
1237 const stroke = darken(hex, 22); // outline
1238
1239 el.style.setProperty('--filr-folder-front', front);
1240 el.style.setProperty('--filr-folder-back', back);
1241 el.style.setProperty('--filr-folder-stroke', stroke);
1242}
1243
1244function applyAllFolderColors(scope = document) {
1245 Object.entries(window.folderColorMap || {}).forEach(([folder, hex]) => {

Callers 5

applyAllFolderColorsFunction · 0.85
saveFolderColorFunction · 0.85
loadMoreChildrenFunction · 0.85
ensureChildrenLoadedFunction · 0.85
folderManager.jsFile · 0.85

Calls 2

lightenFunction · 0.85
darkenFunction · 0.85

Tested by

no test coverage detected