color picker icon

This commit is contained in:
Adrien MALINGREY 2023-10-23 19:28:03 +02:00
parent beebb14464
commit 3a243c38f0
3 changed files with 20 additions and 9 deletions

View File

@ -3,6 +3,10 @@ body {
margin: auto; margin: auto;
} }
.btn {
padding: .275rem .625rem;
}
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { input::-webkit-inner-spin-button {
-webkit-appearance: none !important; -webkit-appearance: none !important;
@ -139,9 +143,10 @@ table input:enabled {
color: var(--bs-secondary-color) !important; color: var(--bs-secondary-color) !important;
} }
#colorPicker{ #colorPickerInput{
width: 2.5rem; width: 2.3rem;
height: auto; height: auto;
padding: .375rem;
} }
@media (prefers-color-scheme:dark) { @media (prefers-color-scheme:dark) {

View File

@ -11,7 +11,6 @@ let history = []
let accessKeyModifiers = "AccessKey+" let accessKeyModifiers = "AccessKey+"
let easyBoxes = [] let easyBoxes = []
let insertRadios = [] let insertRadios = []
let defautColor = ""
function shuffle(iterable) { function shuffle(iterable) {
array = Array.from(iterable) array = Array.from(iterable)
@ -82,9 +81,6 @@ window.onload = function() {
loadSavedGame() loadSavedGame()
defautColor = getComputedStyle(grid).getPropertyValue("--bs-body-color")
colorPicker.value = defautColor
if ("serviceWorker" in navigator) { if ("serviceWorker" in navigator) {
navigator.serviceWorker.register(`service-worker.php?location=${location.pathname}`) navigator.serviceWorker.register(`service-worker.php?location=${location.pathname}`)
} }
@ -176,8 +172,8 @@ function oninput() {
this.previousPlaceholder = this.placeholder this.previousPlaceholder = this.placeholder
refreshBox(this) refreshBox(this)
} }
if (colorPicker.value && colorPicker.value != defautColor) { if (penColor) {
this.style.setProperty("color", colorPicker.value) this.style.setProperty("color", penColor)
} }
} }
@ -328,6 +324,13 @@ function insert(radio) {
} }
} }
let penColor
function changeColor() {
penColor = colorPickerInput.value
colorPickerLabel.style.color = colorPickerInput.value
}
function undo() { function undo() {
if (history.length) { if (history.length) {
const previousState = history.pop() const previousState = history.pop()

View File

@ -24,7 +24,10 @@
<i class="ri-eraser-fill"></i> <i class="ri-eraser-fill"></i>
</label> </label>
</div> </div>
<input type="color" class="btn btn-primary form-control form-control-sm form-control-color" id="colorPicker" title="Changer la couleur"/> <input type="color" class="btn-check" id="colorPickerInput" title="Changer la couleur" oninput="changeColor()"/>
<label id="colorPickerLabel" for="colorPickerInput" class="btn btn-primary" title="Changer de couleur">
<i class="ri-palette-fill"></i>
</label>
<div class='btn-group'> <div class='btn-group'>
<input type='checkbox' id='sightCheckbox' class='btn-check' onclick='highlighterCheckbox.checked = false; refreshUI()' /> <input type='checkbox' id='sightCheckbox' class='btn-check' onclick='highlighterCheckbox.checked = false; refreshUI()' />
<label for='sightCheckbox' class='btn btn-info' title='Surligner la ligne, la colonne et la région de la case survolée'> <label for='sightCheckbox' class='btn btn-info' title='Surligner la ligne, la colonne et la région de la case survolée'>