I have written the following code to edit theme-color based on specific preference (in this case #000000):
window.onload = function () {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#000000');
}
Is it possible to do this dynamically? So that it takes the color of the background through a variable and applies it to the code?