|
|
| Строка 1: |
Строка 1: |
| var darkThemeStyle = document.createElement("style");
| |
| darkThemeStyle.textContent = `
| |
| :root {
| |
| /* Базовые цвета */
| |
| --color-fg: #ffffff;
| |
| --color-bg: #252525;
| |
| --color-bg-opaque: rgba(37, 37, 37, 0.75);
| |
| --color-bg-section: rgba(0, 0, 0, 0.33);
| |
| --color-bg-section-light: rgba(125, 125, 125, 0.075);
| |
| --color-text: rgba(255, 255, 255, 1);
| |
| --color-text-darker: rgba(220, 220, 220, 1);
| |
| --color-text-gray: rgba(185, 185, 185, 0.75);
| |
| --color-text-translucent: rgba(255, 255, 255, 0.5);
| |
| --color-button-text: rgba(255, 255, 255, 1);
| |
| --color-button-text-transparent: rgba(255, 255, 255, 0.5);
| |
| --color-border: rgba(255, 255, 255, 0.1);
| |
| --color-border-input: rgba(128, 181, 255, 1);
| |
| --color-hover: rgba(255, 255, 255, 0.075);
| |
| --color-selected: rgba(255, 255, 255, 0.125);
| |
| }
| |
|
| |
| .light {
| |
| /* Базовые цвета - Light */
| |
| --color-fg: #252525;
| |
| --color-bg: #ffffff;
| |
| --color-bg-opaque: rgba(215, 215, 215, 0.75);
| |
| --color-bg-section: rgba(0, 0, 0, 0.33);
| |
| --color-bg-section-light: rgba(125, 125, 125, 0.075);
| |
| --color-text: rgba(0, 0, 0, 1);
| |
| --color-text-darker: rgba(40, 40, 40, 1);
| |
| --color-text-gray: rgba(80, 80, 80, 0.75);
| |
| --color-text-translucent: rgba(0, 0, 0, 0.5);
| |
| --color-button-text: rgba(255, 255, 255, 1);
| |
| --color-button-text-transparent: rgba(255, 255, 255, 0.5);
| |
| --color-border: rgba(0, 0, 0, 0.1);
| |
| --color-border-input: rgba(128, 181, 255, 1);
| |
| --color-hover: rgba(0, 0, 0, 0.075);
| |
| --color-selected: rgba(0, 0, 0, 0.125);
| |
| }
| |
| `;
| |
|
| |
| document.head.appendChild(darkThemeStyle);
| |
|
| |
| $(document).ready(function() { | | $(document).ready(function() { |
| var button = document.createElement("button"); | | var button = document.createElement("button"); |
$(document).ready(function() {
var button = document.createElement("button");
button.innerHTML = "Сменить тему";
button.className = "theme-button";
button.onclick = toggleTheme;
var container = document.getElementById("p-personal");
if (container) {
container.parentNode.insertBefore(button, container);
}
var isLightTheme = localStorage.getItem("isLightTheme");
if (isLightTheme === "true") {
document.documentElement.classList.add('light');
} else {
document.documentElement.classList.remove('light');
}
});
function toggleTheme() {
var isLightTheme = document.documentElement.classList.toggle('light');
localStorage.setItem("isLightTheme", isLightTheme);
}