Colors are only saved when contrast high enough
This commit is contained in:
parent
eb0031bf87
commit
81d4fe7b7f
@ -293,13 +293,16 @@ const save: Command = {
|
|||||||
|
|
||||||
const currentColors = getColors();
|
const currentColors = getColors();
|
||||||
const color = new Color(currentColors[0]);
|
const color = new Color(currentColors[0]);
|
||||||
if(color.contrast(new Color("#000")) === 1 || color.alpha() < 0.1) result.push("Skipping saving the color because it's too dark.");
|
if(color.contrast(new Color("#000")) < 1.1 || color.alpha() < 0.1) result.push("Skipping saving the color because it's too dark.");
|
||||||
else window.localStorage.setItem("color", currentColors[0]);
|
else {
|
||||||
|
window.localStorage.setItem("color", currentColors[0]);
|
||||||
|
result.push("Color saved to local storage.");
|
||||||
|
}
|
||||||
|
|
||||||
const history = cmdIf.callbacks?.getCmdHistory ? cmdIf.callbacks.getCmdHistory() : [];
|
const history = cmdIf.callbacks?.getCmdHistory ? cmdIf.callbacks.getCmdHistory() : [];
|
||||||
window.localStorage.setItem("history", JSON.stringify(history));
|
window.localStorage.setItem("history", JSON.stringify(history));
|
||||||
|
|
||||||
result.push("Colors and history saved to storage.");
|
result.push("History saved to storage.");
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
return printSyntax(save);
|
return printSyntax(save);
|
||||||
|
Loading…
Reference in New Issue
Block a user