Skip to content

Instantly share code, notes, and snippets.

@sharmaeklavya2
Last active December 6, 2025 18:48
Show Gist options
  • Select an option

  • Save sharmaeklavya2/e8808872c4acd462d6cccff4ffa994c9 to your computer and use it in GitHub Desktop.

Select an option

Save sharmaeklavya2/e8808872c4acd462d6cccff4ffa994c9 to your computer and use it in GitHub Desktop.
nginx autoindex injected CSS
/* color scheme */
body {
--bg-color: white; --text-color: #202020; --link-color: #1a0dab; --vlink-color: #681da8; --tint: rgba(128,128,128,0.2);
}
@media (prefers-color-scheme: dark) {
body {
--bg-color: #1b1e20; --text-color: #c8c8c8; --link-color: #8ab4f8; --vlink-color: #c58af9;
}
}
/* basic */
body {
font-family: sans-serif;
margin: 0; padding: 1em 2.5em; line-height: 1.6; font-size: 1rem;
color: var(--text-color); background-color: var(--bg-color);
}
a:not(:hover) {text-decoration: none;}
a {color: var(--link-color);}
a:visited {color: var(--vlink-color);}
/* autoindex-specific */
body > h1 {
font-size: 2rem;
}
hr {
display: none;
}
body > pre {
font-size: 0;
display: inline-flex;
flex-direction: column;
/* color: transparent; */
}
body > pre > a {
font-size: 1.2rem;
padding: 0.25rem 1rem 0.25rem 0.4rem;
}
body > pre > a:hover, body > pre > a:focus {
background-color: var(--tint);
}
function isTV() {
const ua = navigator.userAgent.toLowerCase();
return ua.includes("smart-tv") || ua.includes("smarttv") || ua.includes("smart tv") || ua.includes("tizen");
}
function main() {
if(isTV()) {
document.body.classList.add("dark");
}
}
if(document.readyState === 'interactive') {
main();
}
else {
document.addEventListener('DOMContentLoaded', main);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment