mirror of
https://github.com/shadoll/theme-switcher.git
synced 2025-12-20 03:27:07 +00:00
556 lines
11 KiB
CSS
556 lines
11 KiB
CSS
html {
|
|
transition: none;
|
|
}
|
|
|
|
:root {
|
|
/* Light theme variables (default) */
|
|
--background-color: #ffffff;
|
|
--text-color: #333333;
|
|
--text-invert-color: #f5f5f5;
|
|
--header-bg: #f5f5f5;
|
|
--footer-bg: #f5f5f5;
|
|
--card-bg: #ffffff;
|
|
--border-color: #dddddd;
|
|
--accent-color: #4a90e2; /* Default accent color */
|
|
--accent-color-rgb: 74, 144, 226; /* RGB values of accent color */
|
|
--button-bg: var(--accent-color);
|
|
--button-text: #ffffff;
|
|
--input-bg: #ffffff;
|
|
--input-border: #cccccc;
|
|
--form-bg: #f9f9f9;
|
|
}
|
|
|
|
/* Dark theme variables */
|
|
[data-theme="dark"] {
|
|
--background-color: #1a1a1a;
|
|
--text-color: #f5f5f5;
|
|
--text-invert-color: #33333;
|
|
--header-bg: #2c2c2c;
|
|
--footer-bg: #2c2c2c;
|
|
--card-bg: #2c2c2c;
|
|
--border-color: #444444;
|
|
--accent-color: #4a90e2; /* Default accent color */
|
|
--accent-color-rgb: 74, 144, 226; /* RGB values of accent color */
|
|
--button-bg: var(--accent-color);
|
|
--button-text: #ffffff;
|
|
--input-bg: #333333;
|
|
--input-border: #555555;
|
|
--form-bg: #252525;
|
|
}
|
|
|
|
/* Add a class to re-enable transitions after page load */
|
|
html.transitions-enabled {
|
|
transition: background-color 0.3s ease, color 0.3s ease;
|
|
}
|
|
|
|
/* Global styles */
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
/* Global layout structure - using grid */
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background-color: var(--background-color);
|
|
color: var(--text-color);
|
|
line-height: 1.6;
|
|
transition: background-color 0.3s ease, color 0.3s ease;
|
|
display: grid;
|
|
grid-template-areas:
|
|
"header"
|
|
"main"
|
|
"footer";
|
|
grid-template-rows: auto 1fr auto;
|
|
min-height: 100vh;
|
|
margin: 0;
|
|
}
|
|
|
|
header {
|
|
grid-area: header;
|
|
background-color: var(--header-bg);
|
|
padding: 1rem 2rem;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
border-bottom: 1px solid var(--border-color);
|
|
flex-wrap: wrap;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.theme-controls {
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.theme-menu-toggle {
|
|
background-color: var(--card-bg);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 50%;
|
|
width: 40px;
|
|
height: 40px;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 8px;
|
|
transition: background-color 0.3s, box-shadow 0.3s;
|
|
}
|
|
|
|
.theme-menu-toggle:hover {
|
|
background-color: var(--background-color);
|
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
|
|
}
|
|
|
|
.theme-menu-toggle svg {
|
|
fill: var(--accent-color);
|
|
}
|
|
|
|
.theme-menu-toggle img,
|
|
.theme-button img {
|
|
width: 24px;
|
|
height: 24px;
|
|
fill: var(--accent-color);
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.theme-menu-toggle img,
|
|
.theme-button img {
|
|
filter: invert(50%) sepia(50%) saturate(1000%) hue-rotate(190deg) brightness(90%) contrast(95%);
|
|
}
|
|
|
|
.theme-button.active img {
|
|
filter: invert(100%);
|
|
}
|
|
|
|
.theme-menu {
|
|
position: absolute;
|
|
top: calc(100% + 8px);
|
|
right: 0;
|
|
background-color: var(--card-bg);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 12px;
|
|
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
|
width: 320px;
|
|
padding: 20px;
|
|
opacity: 0;
|
|
visibility: hidden;
|
|
transform: translateY(-10px);
|
|
transition: opacity 0.3s, transform 0.3s, visibility 0s linear 0.3s;
|
|
z-index: 100;
|
|
}
|
|
|
|
.theme-menu.active {
|
|
opacity: 1;
|
|
visibility: visible;
|
|
transform: translateY(0);
|
|
transition: opacity 0.3s, transform 0.3s, visibility 0s;
|
|
}
|
|
|
|
.menu-section {
|
|
margin-bottom: 20px;
|
|
width: 100%;
|
|
}
|
|
|
|
.menu-section:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.menu-section h4 {
|
|
margin-bottom: 15px;
|
|
font-size: 14px;
|
|
opacity: 0.8;
|
|
}
|
|
|
|
.theme-button-group {
|
|
display: flex;
|
|
background-color: var(--background-color);
|
|
border-radius: 8px;
|
|
padding: 4px;
|
|
border: 1px solid var(--border-color);
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.theme-button {
|
|
flex: 1;
|
|
padding: 10px 12px; /* Slightly more vertical padding */
|
|
border: none;
|
|
background: none;
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 6px;
|
|
color: var(--text-color);
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.theme-button svg {
|
|
width: 18px;
|
|
height: 18px;
|
|
fill: var(--text-color);
|
|
transition: fill 0.2s;
|
|
}
|
|
|
|
/* Active button uses accent color */
|
|
.theme-button.active {
|
|
background-color: var(--accent-color);
|
|
color: white;
|
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
/* Override active button styling */
|
|
.theme-button.active {
|
|
background-color: var(--accent-color);
|
|
color: white;
|
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.theme-button.active svg {
|
|
fill: white; /* White icon when button is active */
|
|
}
|
|
|
|
/* Theme-specific icon styling for better visual cues */
|
|
.theme-button[data-theme="light"] svg {
|
|
color: #f9a825; /* Sunny yellow for light theme */
|
|
}
|
|
|
|
.theme-button[data-theme="dark"] svg {
|
|
color: #9fa8da; /* Soft blue for dark theme */
|
|
}
|
|
|
|
.theme-button[data-theme="system"] svg {
|
|
color: #78909c; /* Neutral blue-grey for system */
|
|
}
|
|
|
|
/* Override fill when active */
|
|
.theme-button.active[data-theme="light"] svg,
|
|
.theme-button.active[data-theme="dark"] svg,
|
|
.theme-button.active[data-theme="system"] svg {
|
|
fill: white;
|
|
}
|
|
|
|
/* Accent Color Styles */
|
|
.accent-color-control {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 15px;
|
|
width: 100%; /* Ensure full width */
|
|
}
|
|
|
|
#accent-color {
|
|
width: 0;
|
|
height: 0;
|
|
opacity: 0;
|
|
position: absolute;
|
|
}
|
|
|
|
.accent-color-preview {
|
|
width: 30px;
|
|
height: 30px;
|
|
border-radius: 50%;
|
|
background-color: var(--accent-color);
|
|
border: 2px solid var(--border-color);
|
|
cursor: pointer;
|
|
transition: transform 0.2s;
|
|
}
|
|
|
|
.accent-color-preview:hover {
|
|
transform: scale(1.1);
|
|
}
|
|
|
|
.accent-color-control label {
|
|
font-size: 14px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
/* Main content styles - using grid */
|
|
main {
|
|
grid-area: main;
|
|
max-width: 1200px;
|
|
margin: 2rem auto;
|
|
padding: 0 2rem;
|
|
width: 100%;
|
|
display: grid;
|
|
grid-template-columns: 1fr;
|
|
gap: 2rem;
|
|
}
|
|
|
|
/* For wider screens, use two columns for content sections */
|
|
@media (min-width: 768px) {
|
|
main {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
|
|
/* Make some sections span full width */
|
|
.content {
|
|
grid-column: 1 / -1;
|
|
}
|
|
}
|
|
|
|
/* Section styles - using flexbox */
|
|
section {
|
|
margin-bottom: 2rem;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1rem;
|
|
}
|
|
|
|
h1, h2, h3, h4 {
|
|
margin-bottom: 1rem;
|
|
color: var(--accent-color);
|
|
}
|
|
|
|
p {
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
a {
|
|
color: var(--accent-color);
|
|
text-decoration: none;
|
|
}
|
|
|
|
a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
/* Card styles - using flexbox */
|
|
.card {
|
|
background-color: var(--card-bg);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 8px;
|
|
padding: 1.5rem;
|
|
margin-bottom: 1.5rem;
|
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1rem;
|
|
}
|
|
|
|
/* Button styles */
|
|
.btn {
|
|
background-color: var(--button-bg);
|
|
color: var(--button-text);
|
|
border: none;
|
|
padding: 0.75rem 1.5rem;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 1rem;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
.btn:hover {
|
|
background-color: var(--button-bg);
|
|
opacity: 0.9;
|
|
}
|
|
|
|
/* Demo form - using grid */
|
|
.demo-form {
|
|
background-color: var(--form-bg);
|
|
padding: 1.5rem;
|
|
border-radius: 8px;
|
|
border: 1px solid var(--border-color);
|
|
display: grid;
|
|
grid-template-columns: 1fr;
|
|
gap: 1rem;
|
|
}
|
|
|
|
@media (min-width: 576px) {
|
|
.demo-form {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
|
|
.form-group {
|
|
grid-column: span 1;
|
|
}
|
|
|
|
.demo-form h4 {
|
|
grid-column: 1 / -1;
|
|
}
|
|
|
|
.demo-form button {
|
|
grid-column: 1 / -1;
|
|
justify-self: start;
|
|
}
|
|
}
|
|
|
|
/* Form group styles - using flexbox */
|
|
.form-group {
|
|
margin-bottom: 1rem;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.form-group label {
|
|
display: block;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.form-group input {
|
|
width: 100%;
|
|
padding: 0.75rem;
|
|
border: 1px solid var(--input-border);
|
|
border-radius: 4px;
|
|
background-color: var(--input-bg);
|
|
color: var(--text-color);
|
|
}
|
|
|
|
/* Footer styles - using flexbox */
|
|
footer {
|
|
grid-area: footer;
|
|
background-color: var(--footer-bg);
|
|
text-align: center;
|
|
padding: 0.5rem 1.5rem;
|
|
border-top: 1px solid var(--border-color);
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
footer p {
|
|
margin: 0;
|
|
color: var(--text-color);
|
|
}
|
|
|
|
/* Theme Dropdown Styles */
|
|
.theme-dropdown {
|
|
position: relative;
|
|
display: inline-block;
|
|
}
|
|
|
|
.theme-toggle {
|
|
background-color: var(--card-bg);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 50%;
|
|
width: 40px;
|
|
height: 40px;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 8px;
|
|
transition: background-color 0.3s, box-shadow 0.3s;
|
|
}
|
|
|
|
.theme-toggle:hover {
|
|
background-color: var(--background-color);
|
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
|
|
}
|
|
|
|
.theme-icon {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.theme-icon svg {
|
|
fill: var(--text-color);
|
|
transition: fill 0.3s;
|
|
}
|
|
|
|
/* Hide all icons by default */
|
|
.theme-toggle .theme-icon {
|
|
display: none;
|
|
}
|
|
|
|
/* Show only the current theme icon */
|
|
[data-theme="light"] .theme-toggle .light-icon,
|
|
.theme-toggle .light-icon {
|
|
display: flex;
|
|
}
|
|
|
|
[data-theme="dark"] .theme-toggle .light-icon {
|
|
display: none;
|
|
}
|
|
|
|
[data-theme="dark"] .theme-toggle .dark-icon {
|
|
display: flex;
|
|
}
|
|
|
|
[data-theme="system"] .theme-toggle .light-icon,
|
|
[data-theme="system"] .theme-toggle .dark-icon {
|
|
display: none;
|
|
}
|
|
|
|
[data-theme="system"] .theme-toggle .system-icon {
|
|
display: flex;
|
|
}
|
|
|
|
.theme-button[data-theme="dark"]{
|
|
color: var(--text-invert-color) !important;
|
|
}
|
|
[data-theme="light"] .theme-button[data-theme="dark"]>svg {
|
|
fill: var(--text-invert-color);
|
|
}
|
|
|
|
.theme-menu {
|
|
position: absolute;
|
|
top: calc(100% + 8px);
|
|
right: 0;
|
|
background-color: var(--card-bg);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
opacity: 0;
|
|
visibility: hidden;
|
|
transform: translateY(-10px);
|
|
transition: opacity 0.3s, transform 0.3s, visibility 0s linear 0.3s;
|
|
z-index: 100;
|
|
color: var(--text-color) !important;
|
|
}
|
|
|
|
.theme-dropdown.active .theme-menu {
|
|
opacity: 1;
|
|
visibility: visible;
|
|
transform: translateY(0);
|
|
transition: opacity 0.3s, transform 0.3s, visibility 0s;
|
|
}
|
|
|
|
/* Clean slate for theme option styling */
|
|
.theme-option {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 10px 15px;
|
|
border: none;
|
|
background: none;
|
|
width: 100%;
|
|
text-align: left;
|
|
cursor: pointer;
|
|
transition: background-color 0.2s;
|
|
|
|
/* Force the text color to match the parent document theme */
|
|
color: var(--text-color);
|
|
}
|
|
|
|
/* Make icons match text color */
|
|
.theme-option .theme-icon svg {
|
|
fill: var(--text-color);
|
|
}
|
|
|
|
/* Hover states */
|
|
.theme-option:hover {
|
|
background-color: rgba(0, 0, 0, 0.05);
|
|
}
|
|
|
|
[data-theme="dark"] .theme-option:hover {
|
|
background-color: rgba(255, 255, 255, 0.05);
|
|
}
|
|
|
|
/* Active state styling */
|
|
.theme-option.active {
|
|
background-color: var(--accent-color);
|
|
}
|
|
|
|
.theme-option.active,
|
|
.theme-option.active .theme-icon svg {
|
|
/* Force white for active option regardless of theme */
|
|
color: white;
|
|
fill: white;
|
|
}
|