From 24806a289f9e35cea3f9c8226114d53d0dcab8bf Mon Sep 17 00:00:00 2001 From: adrien Date: Mon, 23 Oct 2023 16:43:19 +0200 Subject: [PATCH] improve color picker --- css/style.css | 4 ++++ head.php | 30 ++++++++++++++---------------- js/sudoku.js | 12 ++++-------- sudoku.php | 4 +++- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/css/style.css b/css/style.css index c773d3c..3c651e2 100644 --- a/css/style.css +++ b/css/style.css @@ -139,6 +139,10 @@ table input:enabled { color: var(--bs-secondary-color) !important; } +#colorPicker{ + width: 2.5rem; +} + @media (prefers-color-scheme:dark) { .pencil { color: #5a5a5a !important; diff --git a/head.php b/head.php index ab48b17..2c693eb 100644 --- a/head.php +++ b/head.php @@ -7,19 +7,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -32,6 +32,4 @@ -" /> - - \ No newline at end of file +" /> \ No newline at end of file diff --git a/js/sudoku.js b/js/sudoku.js index 73a994a..87c3b91 100755 --- a/js/sudoku.js +++ b/js/sudoku.js @@ -80,6 +80,8 @@ window.onload = function() { } loadSavedGame() + + colorPicker.value = getComputedStyle(document.body).getPropertyValue("--bs-body-color") if ("serviceWorker" in navigator) { navigator.serviceWorker.register(`service-worker.php?location=${location.pathname}`) @@ -172,8 +174,8 @@ function oninput() { this.previousPlaceholder = this.placeholder refreshBox(this) } - if (penColor) { - this.style.setProperty("color", penColor) + if (colorPicker.value) { + this.style.setProperty("color", colorPicker.value) } } @@ -324,12 +326,6 @@ function insert(radio) { } } -let penColor - -function changeColor() { - penColor = colorPicker.value -} - function undo() { if (history.length) { const previousState = history.pop() diff --git a/sudoku.php b/sudoku.php index dd685c2..ecfb258 100755 --- a/sudoku.php +++ b/sudoku.php @@ -24,7 +24,7 @@ - +
+ + \ No newline at end of file