mirror of
https://github.com/danth/stylix
synced 2024-11-26 06:00:23 +00:00
Enable overriding part of theme (#41)
This commit is contained in:
parent
02a1a02386
commit
75ae5f52e2
2 changed files with 31 additions and 1 deletions
12
README.md
12
README.md
|
@ -189,6 +189,18 @@ use:
|
|||
`base16Scheme` can also accept other formats as supported by
|
||||
[`mkSchemeAttrs`](https://github.com/SenchoPens/base16.nix/blob/main/DOCUMENTATION.md#mkschemeattrs).
|
||||
|
||||
## Overriding
|
||||
|
||||
For convenience, it is possible to override parts of `stylix.base16Scheme` using
|
||||
`stylix.override`. Anything that
|
||||
[base16.nix](https://github.com/SenchoPens/base16.nix) accepts as override is
|
||||
valid.
|
||||
|
||||
When using both the Home Manager and NixOS modules, both the system overrides
|
||||
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.
|
||||
|
||||
## Fonts
|
||||
|
||||
The default combination of fonts is:
|
||||
|
|
|
@ -19,6 +19,12 @@ let
|
|||
slug = "stylix";
|
||||
};
|
||||
|
||||
override =
|
||||
(if cfg.base16Scheme == fromOs [ "base16Scheme" ] {}
|
||||
then fromOs [ "override" ] {}
|
||||
else {})
|
||||
// cfg.override;
|
||||
|
||||
in {
|
||||
# TODO link to doc on how to do instead
|
||||
imports = [
|
||||
|
@ -100,11 +106,23 @@ in {
|
|||
but could be overridden manually.
|
||||
'';
|
||||
};
|
||||
|
||||
override = mkOption {
|
||||
description = ''
|
||||
An override that will be applied to stylix.base16Scheme when generating
|
||||
lib.stylix.colors.
|
||||
|
||||
Takes anything that a scheme generated by base16nix can take as argument
|
||||
to override.
|
||||
'';
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
# This attrset can be used like a function too, see
|
||||
# https://github.com/SenchoPens/base16.nix#mktheme
|
||||
lib.stylix.colors = base16.mkSchemeAttrs cfg.base16Scheme;
|
||||
lib.stylix.colors = (base16.mkSchemeAttrs cfg.base16Scheme).override override;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue