Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let root = document.getElementsByTagName("html")[0];
- let className = "custom-theme-background";
- const options = {
- attributes: true
- }
- function callback(mutationList, observer) {
- mutationList.forEach(function(mutation) {
- if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
- if (root.classList.contains(className)) return;
- document.getElementsByTagName("html")[0].classList.add(className)
- var head = document.head || document.getElementsByTagName('head')[0],
- style = document.createElement('style');
- var css = '.custom-theme-background {--custom-theme-background: linear-gradient(128.92deg, var(--bg-gradient-chroma-glow-1) 3.94%, var(--bg-gradient-chroma-glow-2) 26.1%, var(--bg-gradient-chroma-glow-3) 39.82%, var(--bg-gradient-chroma-glow-4) 56.89%, var(--bg-gradient-chroma-glow-5) 76.45%);}';
- head.appendChild(style);
- style.appendChild(document.createTextNode(css));
- }
- })
- }
- const observer = new MutationObserver(callback)
- observer.observe(root, options)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement