diff --git a/scrape/parse.js b/scrape/parse.js index a6a5e72..47c335a 100644 --- a/scrape/parse.js +++ b/scrape/parse.js @@ -198,53 +198,4 @@ export default async function parseThisShit(downloadedFilePath) { fs.writeFileSync("db/current.json", JSON.stringify(data)) } -parseThisShit("downloads/table.xlsx") - - -/** - * Get cell background color as hex (ARGB or theme + tint) - * @param {import('exceljs').Cell} cell - * @returns {string|null} Hex color like "#FF0000" or null if no fill - */ -function getCellHexColor(cell) { - if (!cell.fill || !cell.fill.fgColor) return null; - - const color = cell.fill.fgColor; - - if (color.argb) { - // Direct ARGB color - return `#${color.argb.substring(2)}`; - } - - if (color.theme !== undefined) { - // Default Excel 2013 theme colors - const themeColors = [ - 'FFFFFF', '000000', 'EEECE1', '1F497D', '4F81BD', 'C0504D', '9BBB59', '8064A2', '4BACC6', 'F79646' - ]; - let hex = themeColors[color.theme] || '000000'; - const tint = color.tint || 0; - - // Apply tint inline - let r = parseInt(hex.substring(0, 2), 16); - let g = parseInt(hex.substring(2, 4), 16); - let b = parseInt(hex.substring(4, 6), 16); - - if (tint < 0) { - r = r * (1 + tint); - g = g * (1 + tint); - b = b * (1 + tint); - } else { - r = r + (255 - r) * tint; - g = g + (255 - g) * tint; - b = b + (255 - b) * tint; - } - - r = Math.round(Math.min(255, Math.max(0, r))); - g = Math.round(Math.min(255, Math.max(0, g))); - b = Math.round(Math.min(255, Math.max(0, b))); - - return `#${r.toString(16).padStart(2,'0')}${g.toString(16).padStart(2,'0')}${b.toString(16).padStart(2,'0')}`; - } - - return null; -} +// parseThisShit("downloads/table.xlsx")