Skip to content

Commit

Permalink
doc: explain using lib.stylix.colors
Browse files Browse the repository at this point in the history
The attrset is used heavily in styllix's modules, but the docs don't contain even a top-level explanation of its value. Though you can gather most it from skimming `base16.nix`, I think stylix should provide an entry point for users, interested in using their color schemes outside of stylix. I base this assumption on personal anecdote of people not having a good understanding of exported values even after extended usage and implementing parallel parsing logic for color scheme files.
  • Loading branch information
head-gardener authored Apr 3, 2024
1 parent b6dbe9a commit 5db95bf
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/src/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,30 @@ and the user-provided one are used in the user configuration if
`stylix.base16Scheme` is not changed in the user config. If that is the case,
only the user override is used.

### Accessing

When passing colors to unsupported targets, it is possible to access generated
color scheme through `lib.stylix.colors`. It contains an attrset, populated by
[base16.nix](https://github.com/SenchoPens/base16.nix)'s `mkSchemeAttrs`. TLDR
on its contents is
```nix
lib.stylix.colors = {
base00 = "110021";
# ...
black = "110021";
# ...
withHashtag = {
base00 = "#110021";
# ... i.e. same as the parent but with a hashtag.
};
};
```

For more complex configurations you may find it simpler to use
[mustache](http://mustache.github.io/) templates to generate output files.
See [base16.nix](https://github.com/SenchoPens/base16.nix) documentation for
usage examples.

## Fonts

The default combination of fonts is:
Expand Down Expand Up @@ -161,3 +185,4 @@ Targets are different between Home Manager and NixOS, and sometimes available
in both cases. If both are available, it is always correct to enable both.
The reference pages have a list of targets for [NixOS](options/nixos.md) and
[Home Manager](options/hm.md) respectively.

0 comments on commit 5db95bf

Please sign in to comment.