here's another widget. Somethin aint right with it:
function randomizeCodeColors() {
// Find all code elements that are children of a pre element
const codeElements = document.querySelectorAll("pre code");
// Loop through each code element
codeElements.forEach(code => {
// Find all span elements within the code element
const spanElements = code.querySelectorAll("span");
// Loop through each span element and set a random text color
spanElements.forEach(span => {
span.style.color = getRandomColor();
});
});
}
function getRandomColor() {
// Generate a random hexadecimal color code
return "#" + Math.floor(Math.random()*16777215).toString(16);
}
https://sharegpt.com/c/n63FotM