⭐🚀 TkyNET | Blacklist ve Profesyonel DDoS Korumalı TeamSpeak 3 Sunucuları 🚀⭐
🇹🇷 TR Lokasyon | 🛡️ Gelişmiş DDoS Koruması | ⚡ Düşük Ping | 🎧 Kesintisiz TS3 | Hostlar
Webailesi.comWebailesi.com

PHP Dark-Light Mod Sistemi

Konu

#1
Aşağıdaki kodlardan yapabilirsiniz. html kodunu header kısmına eklemeyi unutmayınız.


1. CSS Kodları
PHP Kod:
:root {
    --bg-color#ffffff;
    --text-color#333333;
    --button-bg#007bff;
}
.
dark-mode {
    --bg-color#181818;
    --text-color#f0f0f0;
    --button-bg#555555;
}
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition0.3s;
}
button {
    background-color: var(--button-bg);
    colorwhite;
    bordernone;
    padding10px 20px;
    cursorpointer;



2. HTML (Buton)
PHP Kod:
<button id="theme-toggle">Mod Değiştir</button


 JavaScript Kodları
PHP Kod:
const btn document.getElementById("theme-toggle");
const 
currentTheme localStorage.getItem("theme");
if (
currentTheme === "dark") {
    document.body.classList.add("dark-mode");
}
btn.addEventListener("click", () => {
    document.body.classList.toggle("dark-mode");
   
    let theme 
"light";
    if (document.body.classList.contains("dark-mode")) {
        theme "dark";
    }
    localStorage.setItem("theme"theme);
}); 
 "Website ve Ücretli eklenti için ulaşabilirsiniz."
Son Düzenleme: 07-04-2026, 19:56, Düzenleyen: -.RuFF.
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da
Task