projekt0n / github-nvim-theme

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

Overridden palette elements must be "re-exported" in specs #303

Open codewiz opened 1 year ago

codewiz commented 1 year ago

I override a few colors in the base palette of my theme:

  palettes = {
    github_dark_high_contrast = {
      bg0 = '#202030',  -- Brighten floats
      bg1 = '#000814',  -- Bluish background
      bg2 = '#200818',  -- Colorcolumn folds
      bg3 = '#001122',  -- Cursor line
      bg4 = '#333333',  -- Conceal
      fg3 = '#333366',  -- LineNr, LspInlayHints
      sel1 = '#885511', -- IncSearch bg
      sel2 = '#cccc33',  -- Search bg
    },

I expected these values to be directly usable like the originals:

  groups = {
    all = {
      Whitespace          = { fg = '#661122' },  -- for listchars
      ExtraWhitespace     = { bg = '#661122' },
      EndOfBuffer         = { fg = 'bg4' },
      Search              = { fg = 'bg1', bg='sel2' },

      LineNr              = { bg = 'bg3', fg = 'fg3' },
      SignColumn          = { link = 'LineNr' },
      GitGutterAdd        = { bg = 'bg3', fg = '#115511' },
      GitGutterChange     = { bg = 'bg3', fg = '#777711' },
      GitGutterDelete     = { bg = 'bg3', fg = '#cc1111' },
      GitGutterChangeLine = { link = 'DiffText' },

      LspInlayHint        = { fg = 'fg3' },
      MatchParen          = { fg = '#000000', bg = '#cccc88' },
      LspReferenceRead    = { bg = '#114411' },
      LspReferenceWrite   = { bg = '#441111' },
      LspReferenceText    = { },
    },
  },

However, none of my overrides works until I "re-export' them at the specs level:

  specs = {
    github_dark_high_contrast = {
      syntax = {
        bracket = '#ffffdd',  -- cream
        comment = '#669966',  -- dark green
        keyword = '#ffaaff',  -- purple
        operator = '#ffff88', -- pale yellow
        -- operator.lua = '#ffff88', -- pale yellow
        param = 'cyan.bright',
        types = 'orange.bright',
      },
      -- FIXME: bug?
      bg0 = 'bg0',
      bg1 = 'bg1',
      bg2 = 'bg2',
      bg3 = 'bg3',
      bg4 = 'bg4',
      fg3 = 'fg3',
      sel1 = 'sel1',
      sel2 = 'sel2',
    },
  },

I assumed it's a bug, but I might be misunderstanding the underlying design. None of the examples in the README covers exactly this case.

My full config is here: https://codewiz.org/pub/dotfiles/init.lua

codewiz commented 1 year ago

By the way, I noticed lua operators are highlighted as keywords rather than operators, and I think it's due to this line

    ['@operator.lua']                           = { fg = syn.keyword, style = stl.operators },

If that was intended to be syn.operator, I could send a PR.

tmillr commented 1 year ago

By the way, I noticed lua operators are highlighted as keywords rather than operators, and I think it's due to this line

This was done on purpose because GitHub's syntax highlighting for Lua deviates from the norm and has "keyword-colored" operators (i.e. usually a reddish or coral color). In other words, currently GitHub uses their "keyword" color for operators when it comes to Lua.

codewiz commented 1 year ago

In other words, currently GitHub uses their "keyword" color for operators when it comes to Lua.

Indeed! Then perhaps they have a bug? ;-)

Anyway, I solved it with this local workaround:

      ['@operator.lua'] = { fg = 'syntax.operator' }, 
tmillr commented 3 months ago

In other words, currently GitHub uses their "keyword" color for operators when it comes to Lua.

Indeed! Then perhaps they have a bug? ;-)

Yeah, although it may be a style/design choice.

tmillr commented 3 months ago

I override a few colors in the base palette of my theme:

  palettes = {
    github_dark_high_contrast = {
      bg0 = '#202030',  -- Brighten floats
      bg1 = '#000814',  -- Bluish background
      bg2 = '#200818',  -- Colorcolumn folds
      bg3 = '#001122',  -- Cursor line
      bg4 = '#333333',  -- Conceal
      fg3 = '#333366',  -- LineNr, LspInlayHints
      sel1 = '#885511', -- IncSearch bg
      sel2 = '#cccc33',  -- Search bg
    },

@codewiz These are the items/keys of the specs table (e.g. bg0, bg1, ...). Did you mean to put them under palettes like you did here?