forked from Shinonome/caelestia-cli
scheme: impl random + fix single schemes
This commit is contained in:
@@ -15,6 +15,7 @@ class Command:
|
||||
|
||||
if self.args.random:
|
||||
scheme.set_random()
|
||||
apply_colours(scheme.colours, scheme.mode)
|
||||
elif self.args.name or self.args.flavour or self.args.mode:
|
||||
if self.args.name:
|
||||
scheme.name = self.args.name
|
||||
|
||||
@@ -187,6 +187,6 @@ def gen_scheme(scheme, primary: Hct, colours: list[Hct]) -> dict[str, str]:
|
||||
colours["success"] = harmonize(base[8], primary)
|
||||
|
||||
# For debugging
|
||||
print("\n".join(["{}: \x1b[48;2;{};{};{}m \x1b[0m".format(n, *c.to_rgba()[:3]) for n, c in colours.items()]))
|
||||
# print("\n".join(["{}: \x1b[48;2;{};{};{}m \x1b[0m".format(n, *c.to_rgba()[:3]) for n, c in colours.items()]))
|
||||
|
||||
return {k: hex(v.to_int())[4:] for k, v in colours.items()}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import random
|
||||
from pathlib import Path
|
||||
|
||||
from caelestia.utils.material import get_colours_for_image
|
||||
@@ -106,6 +107,13 @@ class Scheme:
|
||||
f,
|
||||
)
|
||||
|
||||
def set_random(self) -> None:
|
||||
self._name = random.choice(get_scheme_names())
|
||||
self._flavour = random.choice(get_scheme_flavours())
|
||||
self._mode = random.choice(get_scheme_modes())
|
||||
self._update_colours()
|
||||
self.save()
|
||||
|
||||
def _check_flavour(self) -> None:
|
||||
global scheme_flavours
|
||||
scheme_flavours = None
|
||||
|
||||
Reference in New Issue
Block a user