Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
codewiz opened this issue Oct 2, 2023 · 3 comments
Open

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

codewiz opened this issue Oct 2, 2023 · 3 comments

Comments

@codewiz
Copy link

codewiz commented Oct 2, 2023

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
Copy link
Author

codewiz commented Oct 2, 2023

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
Copy link
Member

tmillr commented Oct 2, 2023

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
Copy link
Author

codewiz commented Oct 2, 2023

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' }, 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants