31 lines
1.8 KiB
JavaScript
31 lines
1.8 KiB
JavaScript
// Body
|
|
document.body.style.backgroundColor = `#${backgroundColor}`;
|
|
document.body.style.color = `#${foregroundColor}`;
|
|
const contentElement = document.getElementById('content'); // commonly used as content div of page
|
|
if (contentElement) {
|
|
contentElement.style.backgroundColor = `#${backgroundColor}`;
|
|
}
|
|
|
|
// Links
|
|
// General
|
|
document.querySelectorAll('a').forEach(link => link.style.color = `#${linkText}`);
|
|
// Hover
|
|
document.querySelectorAll('a').forEach(link => { link.addEventListener('mouseover', () => link.style.color = `#${linkTextHover}`); link.addEventListener('mouseout', () => link.style.color = `#${linkText}`); });
|
|
// Active
|
|
document.querySelectorAll('a').forEach(link => { link.addEventListener('mousedown', () => link.style.color = `#${linkTextActive}`); link.addEventListener('mouseup', () => link.style.color = `#${linkText}`); });
|
|
|
|
// Buttons
|
|
document.querySelectorAll('button').forEach(button => button.style.backgroundColor = `#${buttonBackground}`);
|
|
document.querySelectorAll('button').forEach(button => button.style.color = `#${buttonText}`);
|
|
document.querySelectorAll('button').forEach(button => button.style.borderColor = `#${buttonBorderColor}`);
|
|
|
|
// Input
|
|
document.querySelectorAll('input').forEach(input => input.style.backgroundColor = `#${inputBackground}`);
|
|
document.querySelectorAll('input').forEach(input => input.style.color = `#${inputText}`);
|
|
document.querySelectorAll('input').forEach(input => input.style.borderColor = `#${inputBorderColor}`);
|
|
|
|
// Text area
|
|
document.querySelectorAll('textarea').forEach(textarea => textarea.style.backgroundColor = `#${inputBackground}`);
|
|
document.querySelectorAll('textarea').forEach(textarea => textarea.style.color = `#${inputText}`);
|
|
document.querySelectorAll('textarea').forEach(textarea => textarea.style.borderColor = `#${inputBorderColor}`);
|