projekt0n / github-nvim-theme

GitHub's Neovim themes
MIT License
2.14k stars 106 forks source link

Bad argument #1 to 'rshift' in color.lua:127 #330

Open thewinger opened 5 months ago

thewinger commented 5 months ago

Hi, I'm trying to override the color palettes, but as soon as I add pink, blue or cyan i get the following error message:

Failed to run `config` for github-nvim-theme

...im/lazy/github-nvim-theme/lua/github-theme/lib/color.lua:127: bad argument #1 to 'rshift' (number expected, got nil)

# stacktrace:
  - /github-nvim-theme/lua/github-theme/lib/color.lua:127 _in_ **from_hex**
  - /github-nvim-theme/lua/github-theme/group/editor.lua:22 _in_ **get**
  - /github-nvim-theme/lua/github-theme/group.lua:26 _in_ **from**
  - /github-nvim-theme/lua/github-theme/lib/compiler.lua:33 _in_ **compile**
  - /github-nvim-theme/lua/github-theme/init.lua:37 _in_ **compile**
  - /github-nvim-theme/lua/github-theme/init.lua:109 _in_ **setup**
  - ~/.config/nvim/lua/plugins/colorscheme.lua:43 _in_ **config**
  - ~/.config/nvim/lua/core/lazy.lua:21
  - ~/.config/nvim/lua/core/init.lua:4
  - init.lua:1

This is my config for the theme:

{
  {
    "projekt0n/github-nvim-theme",
    priority = 1000,
    lazy = false,
    config = function()
      local palettes = {
        all = {
          white = "#f8fafc",
          black = "#1d283a",
          gray = "#94a3b8",
          green = "#36d399",
          magenta = "#a689fa",
          red = "#fb6f84",
          yellow = "#fddf49",
          -- pink = "#f471b5",
          blue = "#7ed4fc",
          -- cyan = "#67e8f9",
        },
      }
      local specs = {
        github_dark_dimmed = {
          syntax = {
            keyword = "pink",
          },
        },
      }

      require("github-theme").setup({
        palettes = palettes,
        specs = specs,
        options = {
          transparent = true,
        },
      })
      vim.cmd("colorscheme github_dark_dimmed")
    end,
  },
tmillr commented 4 months ago

Thanks for documenting this. It seems to be due to lines like this:

https://github.com/projekt0n/github-nvim-theme/blob/da7281e343bcab1a96c0de81bbbf258bae6fd1db/lua/github-theme/group/modules/neotree.lua#L29

...which fails because pink is now a string instead of a table of strings (due to your override).