Implement loading a palette from the menu.

This commit is contained in:
Theo Cavignac
2022-12-27 18:18:38 +01:00
committed by Théo Cavignac
parent c08c7f2d0b
commit a36281935b
4 changed files with 31 additions and 12 deletions

View File

@@ -388,10 +388,12 @@ const ColorModule = (() => {
*
* @param {*} paletteColors The colours of the palette
*/
function createColorPalette(paletteColors) {
function createColorPalette(paletteColors, clearCurrent=true) {
//remove current palette
while (colorsMenu.childElementCount > 1)
colorsMenu.children[0].remove();
if (clearCurrent) {
while (colorsMenu.childElementCount > 1)
colorsMenu.children[0].remove();
}
var lightestColor = new Color("hex", '#000000');
var darkestColor = new Color("hex", '#ffffff');
@@ -527,4 +529,4 @@ const ColorModule = (() => {
updateCurrentColor,
getSelectedColor,
}
})();
})();