/* Before running: 1. go to your LABELS page [yourname/your_project/labels/] 2. Opn browser console 3. paste and run the script 4. Copy results [already in clipboard] into file and save */ const rgbToHex = (rgb) => { const rgbValues = rgb.match(/\d+/g); if (!rgbValues || rgbValues.length < 3) return ""; return "#" + rgbValues.slice(0, 3) .map(x => parseInt(x).toString(16).padStart(2, '0')) .join('').toUpperCase(); }; // 1. Target containers that START with the module name const containers = document.querySelectorAll('[class^="Description-module__container"]'); const labelData = Array.from(containers).map(row => { // 2. Use wildcard (*) to find elements containing specific keywords const token = row.querySelector('[class*="TokenBase"]'); const labelEl = row.querySelector('[class*="Text-Text"]'); const descEl = row.querySelector('[class*="labelRowDescriptionItemDescription"]'); const rawColor = token ? window.getComputedStyle(token).backgroundColor : ""; return { label: labelEl?.innerText.trim() || "Not Found", description: descEl?.innerText.trim() || "", color: rawColor ? rgbToHex(rawColor) : "No Color" }; }); if (labelData.length === 0) { console.error("Still returning empty. Try inspecting the page to see if the structure changed!"); } else { console.log(labelData); copy(JSON.stringify(labelData, null, 2)); console.log("Success! Data copied to clipboard."); } console.log("Labels copied to clipboard in HEX format!");