add color picker

This commit is contained in:
Adrien MALINGREY 2023-10-23 09:16:46 +02:00
parent 2e5125c298
commit 4a0d03f445
2 changed files with 10 additions and 0 deletions

View File

@ -172,6 +172,9 @@ function oninput() {
this.previousPlaceholder = this.placeholder this.previousPlaceholder = this.placeholder
refreshBox(this) refreshBox(this)
} }
if (penColor) {
this.style.setProperty("color", penColor)
}
} }
function refreshBox(box) { function refreshBox(box) {
@ -321,6 +324,12 @@ function insert(radio) {
} }
} }
let penColor
function changeColor() {
penColor = colorPicker.value
}
function undo() { function undo() {
if (history.length) { if (history.length) {
const previousState = history.pop() const previousState = history.pop()

View File

@ -24,6 +24,7 @@
<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="Couleur" oninput="changeColor()" value="var(--bs-body-color)"/>
<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'>