diff --git a/docs/index.html b/docs/index.html
index 9710379..487450d 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -100,7 +100,7 @@
target="_blank"
>
{
+ productHunt.src = `https://api.producthunt.com/widgets/embed-image/v1/top-post-badge.svg?post_id=150490&theme=${theme}&period=daily`
+}
+
const updateTheme = () => {
const theme = themeForm.theme.value
const fileName = `${theme === 'auto' ? 'water' : theme}.min.css`
@@ -40,11 +45,19 @@ const updateTheme = () => {
} else {
table.theme.innerText = `Theme is forced to ${theme}`
table.browserSupport.innerText = 'All browsers (including Internet Explorer)'
+ updateProductHunt(theme)
}
}
themeForm.addEventListener('input', updateTheme)
+const prefersColorScheme = window.matchMedia('(prefers-color-scheme: light)')
+updateProductHunt(prefersColorScheme.matches ? 'light' : 'dark')
+prefersColorScheme.addEventListener('change', () => {
+ if (themeForm.theme.value !== 'auto') return
+ updateProductHunt(prefersColorScheme.matches ? 'light' : 'dark')
+})
+
updateTheme()
startupStylesheet.remove()
@@ -129,7 +142,7 @@ startupStylesheet.remove()
// /** Handles elements external to the version picker that still need to be kept
// * up to date with the current version, e.g. switching images from dark to light. */
// const externalElements = {
-// _productHunt: /** @type {HTMLImageElement} */ (document.querySelector('#js-producthunt')),
+// _productHunt: /** @type {HTMLImageElement} */ (document.querySelector('#product-hunt')),
// _stylesheet: /** @type {HTMLLinkElement} */ (document.querySelector('#js-stylesheet')),
// _removeStartupStylesheet: () => {
// const startupStylesheet = document.head.querySelector('#js-startup-stylesheet')
diff --git a/docs/style.css b/docs/style.css
index 0e652bc..34b20f8 100755
--- a/docs/style.css
+++ b/docs/style.css
@@ -2,7 +2,7 @@ html {
scroll-behavior: smooth;
}
-#js-producthunt {
+#product-hunt {
margin-top: 1rem;
}