diff --git a/code/index.css b/code/index.css
index 4772854..1d7e1f0 100644
--- a/code/index.css
+++ b/code/index.css
@@ -9,6 +9,19 @@
}
+.day { background: #eee; color: black; }
+.night { background: #333; color: white; }
+
+@media (prefers-color-scheme: dark) {
+ .day.dark-scheme { background: #333; color: white; }
+ .night.dark-scheme { background: black; color: #ddd; }
+}
+
+@media (prefers-color-scheme: light) {
+ .day.light-scheme { background: white; color: #555; }
+ .night.light-scheme { background: #eee; color: black; }
+}
+
.button {
padding: 2px;
}
@@ -104,4 +117,13 @@
.pickr {
width: 30px;
height: 30px;
+ }
+
+ .logo {
+ text-align: center;
+ }
+
+ .lightButton {
+ position: absolute;
+ right: 0px;
}
\ No newline at end of file
diff --git a/code/index.php b/code/index.php
index 971842f..23aad8d 100644
--- a/code/index.php
+++ b/code/index.php
@@ -5,7 +5,15 @@
-
+
+
+
+

+

+
+
+
+
@@ -101,5 +109,6 @@
+
diff --git a/code/ress/dark.PNG b/code/ress/dark.PNG
new file mode 100644
index 0000000..284006b
Binary files /dev/null and b/code/ress/dark.PNG differ
diff --git a/code/ress/light.png b/code/ress/light.png
new file mode 100644
index 0000000..699cba0
Binary files /dev/null and b/code/ress/light.png differ
diff --git a/code/ress/logo_clair.png b/code/ress/logo_clair.png
index d44153b..15d0f97 100644
Binary files a/code/ress/logo_clair.png and b/code/ress/logo_clair.png differ
diff --git a/code/ress/logo_dark.png b/code/ress/logo_dark.png
new file mode 100644
index 0000000..38708bc
Binary files /dev/null and b/code/ress/logo_dark.png differ
diff --git a/code/score.php b/code/score.php
index 6538d59..3447d24 100644
--- a/code/score.php
+++ b/code/score.php
@@ -40,11 +40,11 @@ if($_GET['pseudo']!="")
{
if(stristr($_GET['mode'], "p") === FALSE) // vérification du mode pour afficher le score le plus grand ou le plus petit (- de temps = + de score)
{ //il n'y a pas "p" dans le mode, donc on cherche le plus haut score
- $sqlScore='select max(score) from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].' and player="'.$_GET['pseudo'].'"';
+ $sqlScore='select min(score) from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].' and player="'.$_GET['pseudo'].'"';
}
else
{ // on est en points, donc on cherche le temps le plus faible
- $sqlScore='select min(score) from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].' and player="'.$_GET['pseudo'].'"';
+ $sqlScore='select max(score) from score where game_mode="'.$_GET['mode'].'" and difficulty="'.$_GET['diff'].'" and dots_amount='.$_COOKIE["dotsAmount"].' and pause='.$_COOKIE["pause"].' and player="'.$_GET['pseudo'].'"';
}
$result = $database->query($sqlScore); // on prend le meilleur score du joueur
$data = $result->fetchArray()[0];
diff --git a/code/themeSwitcher.js b/code/themeSwitcher.js
new file mode 100644
index 0000000..07f0d77
--- /dev/null
+++ b/code/themeSwitcher.js
@@ -0,0 +1,21 @@
+var light= (getCookie("light")=="" ? true : getCookie("light"));
+
+document.getElementById("light").width=size/4;
+
+function switchLight() {
+ console.log("light avant "+light);
+ light=(light=="true" ? "false" : "true");
+ console.log("light après "+light);
+ setCookie("light",light,30);
+ applyLight(light);
+}
+
+function applyLight(li) {
+ console.log("app li "+li);
+ document.getElementById("light").src="ress/"+(li=="true" ? "light" : "dark")+".png";
+ document.getElementById("logo").src="ress/logo_"+(li=="true" ? "clair" : "dark")+".png";
+ document.getElementsByTagName("body")[0].classList.add((li=="true" ? "day" : "night"));
+ document.getElementsByTagName("body")[0].classList.remove((li=="true" ? "night" : "day"));
+}
+
+applyLight(light);
\ No newline at end of file