< User:Isy
Created page with "→* * MediaWiki Theme Toggle Button - Simple UI, not setup to be like example design * * CSS for light/dark mode toggle with theme variables * Compatible with MediaWiki styles: →Theme variables - Light theme (default): :root[data-theme="light"] { →Base colors: --mw-color-background: #ffffff; --mw-color-surface: #f8f9fa; --mw-color-text-primary: #202122; --mw-color-text-secondary: #54595d; --mw-color-border: #c8ccd1; --mw-color..." |
No edit summary |
||
| Line 1: | Line 1: | ||
/* | /* Fallback colors for strict validators */ | ||
.dark-mode-experiment { | |||
background: #ffffff; /* Fallback */ | |||
color: #202122; /* Fallback */ | |||
--mw-bg: #ffffff; | |||
--mw-surface: #f8f9fa; | |||
--mw-text: #202122; | |||
--mw-border: #a2a9b1; | |||
--mw-link: #0645ad; | |||
--mw-code-bg: #f8f9fa; | |||
--mw | |||
--mw- | |||
--mw | |||
--mw | |||
--mw- | |||
--mw | |||
} | } | ||
.dark-mode-experiment[data-theme="dark"] { | |||
background: #1f1f1f; /* Fallback */ | |||
color: #e0e0e0; /* Fallback */ | |||
--mw-bg: #1f1f1f; | |||
--mw-surface: #2a2a2a; | |||
--mw-text: #e0e0e0; | |||
--mw-border: #555555; | |||
--mw-link: #6699ff; | |||
--mw-code-bg: #2a2a2a; | |||
--mw | |||
--mw- | |||
--mw | |||
--mw | |||
--mw- | |||
--mw | |||
} | } | ||
/* | /* Main content - with fallbacks */ | ||
: | .dark-mode-experiment .mw-parser-output { | ||
background: #ffffff; | |||
background: var(--mw-bg); | |||
color: #202122; | |||
color: var(--mw-text); | |||
transition: all 0.3s ease; | transition: all 0.3s ease; | ||
min-height: 80vh; | |||
padding: 20px; | |||
} | } | ||
/* Links */ | /* Links */ | ||
.dark-mode-experiment a { | |||
color: #0645ad; | |||
color: var(--mw-link); | |||
a | |||
color: | |||
color: var(--mw | |||
} | } | ||
/* Tables */ | /* Tables */ | ||
.dark-mode-experiment table.wikitable { | |||
background: #f8f9fa; | |||
background: var(--mw-surface); | |||
border-color: #a2a9b1; | |||
border-color: var(--mw-border); | |||
table.wikitable | |||
background | |||
background | |||
border-color: | |||
border-color: var(--mw | |||
} | } | ||
/* Code blocks */ | /* Code blocks */ | ||
code | .dark-mode-experiment code, | ||
.dark-mode-experiment pre { | |||
. | background: #f8f9fa; | ||
background | background: var(--mw-code-bg); | ||
} | } | ||
/* | /* Toggle button */ | ||
.dark-mode-toggle { | |||
position: fixed; | |||
bottom: 20px; | |||
. | right: 20px; | ||
z-index: 1000; | |||
width: 40px; | |||
height: 40px; | |||
width: | |||
height: | |||
border-radius: 50%; | border-radius: 50%; | ||
background: #f8f9fa; | |||
background: var(--mw-surface); | |||
color: #202122; | |||
color: var(--mw-text); | |||
border: 1px solid #a2a9b1; | |||
border: 1px solid var(--mw-border); | |||
cursor: pointer; | cursor: pointer; | ||
font-size: 1.2em; | |||
display: flex; | display: flex; | ||
align-items: center; | align-items: center; | ||
justify-content: center; | justify-content: center; | ||
} | } | ||
Latest revision as of 01:48, 23 April 2025
/* Fallback colors for strict validators */
.dark-mode-experiment {
background: #ffffff; /* Fallback */
color: #202122; /* Fallback */
--mw-bg: #ffffff;
--mw-surface: #f8f9fa;
--mw-text: #202122;
--mw-border: #a2a9b1;
--mw-link: #0645ad;
--mw-code-bg: #f8f9fa;
}
.dark-mode-experiment[data-theme="dark"] {
background: #1f1f1f; /* Fallback */
color: #e0e0e0; /* Fallback */
--mw-bg: #1f1f1f;
--mw-surface: #2a2a2a;
--mw-text: #e0e0e0;
--mw-border: #555555;
--mw-link: #6699ff;
--mw-code-bg: #2a2a2a;
}
/* Main content - with fallbacks */
.dark-mode-experiment .mw-parser-output {
background: #ffffff;
background: var(--mw-bg);
color: #202122;
color: var(--mw-text);
transition: all 0.3s ease;
min-height: 80vh;
padding: 20px;
}
/* Links */
.dark-mode-experiment a {
color: #0645ad;
color: var(--mw-link);
}
/* Tables */
.dark-mode-experiment table.wikitable {
background: #f8f9fa;
background: var(--mw-surface);
border-color: #a2a9b1;
border-color: var(--mw-border);
}
/* Code blocks */
.dark-mode-experiment code,
.dark-mode-experiment pre {
background: #f8f9fa;
background: var(--mw-code-bg);
}
/* Toggle button */
.dark-mode-toggle {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 1000;
width: 40px;
height: 40px;
border-radius: 50%;
background: #f8f9fa;
background: var(--mw-surface);
color: #202122;
color: var(--mw-text);
border: 1px solid #a2a9b1;
border: 1px solid var(--mw-border);
cursor: pointer;
font-size: 1.2em;
display: flex;
align-items: center;
justify-content: center;
}