You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a major change, but the only breaking change is the lib function namespace.
You can now use either nix-colors-style schemes, or base16 YAML schemes directly, using the new `schemeFromYAML` function.
Opinionated functions have been moved into `lib-contrib`.
base16 has moved to an org, so with that in mind we no longer need to vendor schemes here.
Docs has been updated, and the repo was cleaned up from now-unneeded stuff.
All occurences of "color(S|s)cheme(s)" have been normalized to "colorScheme(s)", with "colorscheme(s)" as aliases.
Changelog:
- Add `schemeFromYAML` and `schemeToYAML` functions.
- These are pure nix, and allow us to finally use base16-project's `.yaml` schemes without requiring users to pass `pkgs` or specify `system`.
- Use base16-project scheme repository. There is a scheme monorepo now, which makes our lives a lot easier
- We no longer vendor schemes.
- The schemes we previously had were upstreamed on tinted-theming/base16-schemes#1
- Move opinionated functions into `lib-contrib`
- Update docs
- Clean up repo
This repo is designed to help with Nix(OS) theming.
5
5
6
-
At the core, we have an attribute set with 220+ base16 schemes, as well as a [home-manager](https://github.com/nix-community/home-manager) module for globally setting your preferred one.
6
+
At the core, we expose a nix attribute set with 220+ base16 schemes, as well as
7
+
a [home-manager](https://github.com/nix-community/home-manager) module for
8
+
globally setting your preferred one.
7
9
8
-
Plus some optional [functions](lib-usage.md) for common use cases (generating scheme from image, generating wallpaper, vim scheme, gtk theme).
10
+
These schemes are not vendored in: they are directly fetch (and flake locked!)
11
+
from [base16-schemes](https://github.com/base16-project/base16-schemes), then
12
+
converted using our (pure nix) `schemeFromYAML` function, which is also exposed
13
+
for your convenience. This means you can easily make your own schemes, in
14
+
either nix-colors (`.nix`) or base16 (`.yaml`) format, freely converting
15
+
between the two.
9
16
10
-
## Base16?
11
-
[Base16](https://github.com/chriskempson/base16) is a standard for defining palettes (schemes), and how each app should be themed (templates).
12
-
13
-
nix-colors focuses on delivering you just the schemes, while being easy to use, flexible, and unopinionated.
14
-
15
-
## Existing solutions?
16
-
Nix is amazing and lets people do stuff their way, so people end up with lots of different (often incompatible) solutions to the same problem.
17
+
The core portion of nix-colors is very unopinionated and should work with all
18
+
possible workflows very easily, without any boilerplate code.
17
19
18
-
Theming is one of them. Based on [rycee's](https://gitlab.com/rycee/nur-expressions/-/tree/master/hm-modules/theme-base16), some of my experience with creating a [base16 theming workflow](https://github.com/misterio77/flavours), and a demand for a easy way to expose multiple schemes, i decided to create this.
20
+
We also have some optional contrib functions for opinionated, common use cases
21
+
(generating scheme from image, generating wallpaper, vim scheme, gtk theme).
19
22
20
-
Perhaps this could become a standard solution for a common problem.
23
+
## Base16?
24
+
[Base16](https://github.com/base16-project/base16) is a standard for defining
25
+
palettes (schemes), and how each app should be themed (templates).
Then, at the top of your config file(s) add `nix-colors ? <nix-colors>` as an argument (instead of just `nix-colors`).
87
+
Then, at the top of your config file(s) add `nix-colors ? <nix-colors>` as an
88
+
argument (instead of just `nix-colors`).
76
89
77
90
## Using
78
91
79
92
With that done, move on to your home manager configuration.
80
93
81
-
You should import the `nix-colors.homeManagerModule`, and set the option `colorscheme` to your preferred scheme, such as `nix-colors.colorSchemes.dracula`
94
+
You should import the `nix-colors.homeManagerModule`, and set the option
95
+
`colorScheme` to your preferred scheme, such as
96
+
`nix-colors.colorSchemes.dracula`
82
97
83
-
Here's a quick example on how to use it with, say, a terminal emulator (kitty) and a browser (qutebrowser):
98
+
Here's a quick example on how to use it with, say, a terminal emulator (kitty)
This path can come from wherever nix can read, even another repo! That's what
192
+
we do to expose base16's schemes.
193
+
194
+
### `schemeToYAML`
195
+
196
+
Maybe you took a liking to writting (or generating) colors in nix-colors sweet
197
+
nix syntax, but want to contribute back to base16. No, no, don't write that
198
+
YAML by hand!
199
+
200
+
We have a `schemeToYAML` for converting from nix-colors's `.nix` to
201
+
base16's `.yaml` format.
154
202
155
-
No problem with `nix-colors`! The fact that we expose all schemes means you can easily use `nix eval` to list schemes (or even grab and print out their colors), for all your scripting needs.
203
+
Grab your nix-colors scheme, pass it to the function, and you get the YAML
204
+
string (you can write it `toFile` if you want) in return. Here's an example
This assumes you have nix-colors set as a nix registry. You can easily do it by passing `nix-colors` from your flake to your system configuration, and using:
212
+
### More soon(TM)
213
+
214
+
We plan on helping you turn existing base16 templates into nifty nix functions
215
+
real soon, as well as converting colors between hex and decimal. Stay tuned!
216
+
217
+
## Contributed functions
218
+
219
+
We also have a few opinionated functions for some common scheme usecases: such
220
+
as generating schemes from an image, generating an image from a scheme... You get
221
+
the idea.
222
+
223
+
These nifty pals are listed (and documented) at `./lib/contrib/default.nix`.
224
+
They are exposed at `nix-colors.lib-contrib`.
225
+
226
+
Do note these require `nixpkgs`, however. You should pass your `pkgs` instance
227
+
to `nix-colors.lib-contrib` to use them. For example:
Please please upstream nice schemes you have created!
244
+
245
+
It's pretty easy to do. Just open up a PR on
246
+
[base16-schemes](https://github.com/base16-project/base16-schemes), and once
247
+
it's in it will be available here.
248
+
249
+
If it takes a while to be merged, you can temporarily put it together with your
250
+
config and use [`schemeFromYAML`](#schemeFromYAML) to load it.
251
+
252
+
Alternatively, you can tell nix-colors to follow your base16-schemes fork.
253
+
There's two ways to do it.
254
+
255
+
- In your flake inputs, add `base16-schemes` and override
256
+
`nix-colors.inputs.base16-schemes.follows`:
161
257
```nix
162
258
{
163
-
nix.registry.nix-colors.flake = nix-colors;
259
+
description = "Your cool config flake";
260
+
inputs = {
261
+
base16-schemes = "github:you/nix-colors"; # Your base16-schemes fork
262
+
263
+
nix-colors.url = "github:misterio77/nix-colors";
264
+
nix-colors.inputs.base16-schemes.follows = "base16-schemes"; # Be sure to add this
265
+
# ...
266
+
};
267
+
# ...
164
268
}
165
269
```
166
270
167
-
It is quite nice to add all your flake inputs as system registries, [here's an example on how to do it](https://github.com/Misterio77/nix-starter-config/blob/minimal/configuration.nix#L67).
271
+
- Fork `nix-colors` and edit our `flake.nix` to point at your `base16-schemes`
272
+
repo. Then update your flake config to use your `nix-colors` fork.
168
273
169
274
# Thanks
170
275
@@ -173,8 +278,3 @@ Special thanks to rycee for most of this repo's inspiration, plus for the amazin
173
278
Huge thanks for everyone involved with base16.
174
279
175
280
Extra special thanks for my folks at the NixOS Brasil Telegram group, for willing to try this out!
176
-
177
-
178
-
# Roadmap
179
-
- Add support for base24 (which is backwards compatible with base16)
180
-
- Add more functions for pre-configured application theming (i'd love your help!)
0 commit comments