Color preview in one line and bug fixing

This commit is contained in:
2022-06-12 19:57:34 +02:00
parent df2cf98b22
commit f33b15bfa0
2 changed files with 13 additions and 8 deletions

View File

@ -225,15 +225,16 @@ const color: Command = {
window.document.documentElement.style.removeProperty("--repl-color-hint");
return ["Color reset."];
} else {
let color: Color;
try {
const color = Color(args.join().trim());
window?.document.documentElement.style.setProperty("--repl-color", color.string());
window?.document.documentElement.style.setProperty("--repl-color-link", color.lighten(0.3).rgb().string());
window?.document.documentElement.style.setProperty("--repl-color-hint", color.fade(0.7).string());
color = Color(args.join().trim());
} catch {
return ["Invalid color!"];
}
return ["Color set.", "#{Link|https://google.de}.", "%{command}"];
window?.document.documentElement.style.setProperty("--repl-color", color.string());
window?.document.documentElement.style.setProperty("--repl-color-link", color.lighten(0.3).rgb().string());
window?.document.documentElement.style.setProperty("--repl-color-hint", color.fade(0.7).string());
return ["Color set | #{Link|#} | %{help}"];
}
}
};