lx-music-desktop/src/renderer-lyric/index.html
2023-08-17 17:49:47 +08:00

32 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en" style="background-color: transparent;">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>桌面歌词-洛雪音乐助手</title>
</head>
<body id="body" style="background-color: transparent;">
<div id="root"></div>
<script>
window.dom_style_theme = document.createElement('style')
window.dom_style_lyric = document.createElement('style')
window.setTheme = colors => {
window.dom_style_theme.innerText = `:root {${(Object.entries(colors)).map(([key, value]) => `${key}:${value};`).join('')}}`
}
window.setLyricColor = colors => {
console.log(colors)
window.dom_style_lyric.innerText = `:root {${(Object.entries(colors)).map(([key, value]) => `${key}:${value};`).join('')}}`
}
document.body.appendChild(window.dom_style_lyric)
const applyThemeColor = (theme) => {
theme = JSON.parse(decodeURIComponent(theme))
window.setTheme(theme.colors)
document.body.appendChild(window.dom_style_theme)
}
if (/theme=(.+)(#|$)/.test(window.location.search)) applyThemeColor(RegExp.$1)
</script>
</body>
</html>