diff --git a/README.md b/README.md index 82fd0e90..c4ab77eb 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,9 @@ You can force a light or dark theme using the polarity option: stylix.polarity = "dark"; ``` +The generated scheme can be viewed in a web browser at +`file:///etc/stylix/palette.html`. + ### Mixed color schemes You can override part of the scheme by hand, perhaps to select background diff --git a/stylix/palette.html.mustache b/stylix/palette.html.mustache new file mode 100644 index 00000000..0b5f9323 --- /dev/null +++ b/stylix/palette.html.mustache @@ -0,0 +1,68 @@ + +
+ + + +Each color should be used as described in this table.
+See the Stylix documentation for how to apply these colors on NixOS.
+ + \ No newline at end of file diff --git a/stylix/palette.nix b/stylix/palette.nix index 22cd6f33..d6aeeefa 100644 --- a/stylix/palette.nix +++ b/stylix/palette.nix @@ -78,14 +78,23 @@ in { }; config = { - # Making palette.json part of the system closure will protect it from - # garbage collection, so future configurations can be evaluated without - # having to generate the palette again. The generator is not kept, only the - # palette which came from it, so this uses very little disk space. - system.extraDependencies = [ paletteJSON ]; - # This attrset can be used like a function too, see # https://github.com/SenchoPens/base16.nix#mktheme lib.stylix.colors = base16.mkSchemeAttrs cfg.base16Scheme; + + environment.etc = { + # Making palette.json part of the system closure will protect it from + # garbage collection, so future configurations can be evaluated without + # having to generate the palette again. The generator is not kept, only + # the palette which came from it, so this uses very little disk space. + "stylix/palette.json".source = paletteJSON; + + # We also provide a HTML version which is useful for viewing the colors + # during development. + "stylix/palette.html".source = config.lib.stylix.colors { + template = builtins.readFile ./palette.html.mustache; + extension = ".html"; + }; + }; }; }