doc: explain using lib.stylix.colors (#328)

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.
This commit is contained in:
head-gardener 2024-05-18 16:01:01 +03:00 committed by GitHub
parent 4a4c82f03c
commit 76e7daf5a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -69,6 +69,37 @@ 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.
### Extending
When passing colors to unsupported targets or creating custom modules, it
is possible to access values from the configured color scheme through
`lib.stylix.colors`.
An overview of the available values is shown below.
```nix
lib.stylix.colors = {
base08 = "ff0000";
base08-hex-r = "ff";
base08-dec-r = "0.996094";
# ...
red = "ff0000";
# ...
withHashtag = {
base08 = "#ff0000";
# ...
};
};
```
This attrset is generated by `mkSchemeAttrs` from `base16.nix`. Refer to the
[documentation](https://github.com/SenchoPens/base16.nix/blob/main/DOCUMENTATION.md#mkschemeattrs)
for more info.
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: