Coder Social home page Coder Social logo

Usage with Nix-colors about nixvim HOT 13 CLOSED

nix-community avatar nix-community commented on May 27, 2024
Usage with Nix-colors

from nixvim.

Comments (13)

GaetanLepage avatar GaetanLepage commented on May 27, 2024 1

Ok good !
Feel free to come back if you think that something is missing :)

from nixvim.

jhilker98 avatar jhilker98 commented on May 27, 2024 1

Yes, I was able to get it working now. Not totally sure what changed, but it works. :)

from nixvim.

GaetanLepage avatar GaetanLepage commented on May 27, 2024 1

@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}";
    };
  };
};

from nixvim.

dwarfmaster avatar dwarfmaster commented on May 27, 2024

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.

from nixvim.

jhilker98 avatar jhilker98 commented on May 27, 2024

Thanks!

from nixvim.

dwarfmaster avatar dwarfmaster commented on May 27, 2024

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.

from nixvim.

jhilker98 avatar jhilker98 commented on May 27, 2024

alright, I'll try that.

from nixvim.

GaetanLepage avatar GaetanLepage commented on May 27, 2024

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.

from nixvim.

jhilker98 avatar jhilker98 commented on May 27, 2024

I will go ahead and close it - so far the implementation that @dwarfmaster has is working for me.

from nixvim.

waot avatar waot commented on May 27, 2024

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.

from nixvim.

jhilker98 avatar jhilker98 commented on May 27, 2024

I had also noticed infinite recursion with that setup, even when using an official colorscheme (gruvbox-dark-hard in my case).

from nixvim.

GaetanLepage avatar GaetanLepage commented on May 27, 2024

@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 ?

from nixvim.

dwarfmaster avatar dwarfmaster commented on May 27, 2024

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.

from nixvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.