Closed jhilker98 closed 1 year ago
If you're using an official base16 theme, you can do :
{ config, lib, ... }:
{
programs.nixvim = {
colorschemes.base16 = {
enable = true;
useTruecolor = true;
colorscheme = lib.toLower config.colorScheme.name;
};
};
}
For a more robust solution, it would be possible to package nvim-base16 and create a colorscheme based on it, since it directly takes the individual colors as arguments. I'll probably do that at some point if I find the time.
Thanks!
I'll probably open a PR at some point, but for the moment you can copy this to set it up. Another advantage is that you can just set lualine theme to base16
and it just works with this plugin.
alright, I'll try that.
Is it relevant to add this feature to nixvim ? If so, I guess I could easily port the implementation of @dwarfmaster or look for another solution. Else, we might close this issue.
I will go ahead and close it - so far the implementation that @dwarfmaster has is working for me.
Ok good ! Feel free to come back if you think that something is missing :)
If you're using an official base16 theme, you can do :
{ config, lib, ... }: { programs.nixvim = { colorschemes.base16 = { enable = true; useTruecolor = true; colorscheme = lib.toLower config.colorScheme.name; }; }; }
For a more robust solution, it would be possible to package nvim-base16 and create a colorscheme based on it, since it directly takes the individual colors as arguments. I'll probably do that at some point if I find the time.
@dwarfmaster Does this also work for a custom Base16 setup, when i copy your code, it gives me an infinite recursion error.
I had also noticed infinite recursion with that setup, even when using an official colorscheme (gruvbox-dark-hard in my case).
@jhilker98, I tested the following setup and it works fine:
{ config, lib, ... }:
{
programs.nixvim = {
colorschemes.base16 = {
enable = true;
useTruecolor = true;
colorscheme = "gruvbox-dark-hard";
};
};
}
Do you still encounter this issue ?
Yes, I was able to get it working now. Not totally sure what changed, but it works. :)
If you're using an official base16 theme, you can do :
{ config, lib, ... }: { programs.nixvim = { colorschemes.base16 = { enable = true; useTruecolor = true; colorscheme = lib.toLower config.colorScheme.name; }; }; }
For a more robust solution, it would be possible to package nvim-base16 and create a colorscheme based on it, since it directly takes the individual colors as arguments. I'll probably do that at some point if I find the time.
@dwarfmaster Does this also work for a custom Base16 setup, when i copy your code, it gives me an infinite recursion error.
I am now using something based on nvim-base16
that supports custom colors, see here. Note that I am not using nix-colors
anymore but stylix
, however the code should be easy to adapt.
@dwarfmaster we switched to using nvim-base16
for the backend of colorschemes.base16
.
When #504 will be merged, your setup can become:
programs.nixvim = {
colorschemes.base16 = {
enable = true;
colorscheme = colors.scheme-slug;
customColorScheme = {
base00 = "#${colors.base00}";
base01 = "#${colors.base01}";
base02 = "#${colors.base02}";
base03 = "#${colors.base03}";
base04 = "#${colors.base04}";
base05 = "#${colors.base05}";
base06 = "#${colors.base06}";
base07 = "#${colors.base07}";
base08 = "#${colors.base08}";
base09 = "#${colors.base09}";
base0A = "#${colors.base0A}";
base0B = "#${colors.base0B}";
base0C = "#${colors.base0C}";
base0D = "#${colors.base0D}";
base0E = "#${colors.base0E}";
base0F = "#${colors.base0F}";
};
};
};
I'm currently using nix-colors for managing my color schemes, and I have been trying to use the vim colorscheme function that nix-colors provides in order to use it. However, whenever I use it in my config for nixvim, I get the same error of
error: colorscheme gruvbox-dark-hard not found
. What do I need to do to fix this?