Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
table_01 [2023/09/21 08:09] – demiurge | table_01 [2023/09/22 22:03] (current) – demiurge | ||
---|---|---|---|
Line 1609: | Line 1609: | ||
</ | </ | ||
</ | </ | ||
+ | < | ||
+ | function applyHexColorToTableCells() { | ||
+ | // Get all table cells | ||
+ | let tableCells = document.querySelectorAll(' | ||
+ | |||
+ | // Regular expression to match hex color codes | ||
+ | let hexPattern = /# | ||
+ | |||
+ | tableCells.forEach(cell => { | ||
+ | // Find all hex codes in the text of the cell | ||
+ | let matches = cell.textContent.match(hexPattern); | ||
+ | |||
+ | if (matches && matches.length > 0) { | ||
+ | // If there' | ||
+ | // to the hex code found in the cell | ||
+ | cell.style.color = matches[0]; | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | // Call the function on page load | ||
+ | applyHexColorToTableCells(); | ||
+ | </ | ||
</ | </ |