nvim-config

Log | Files | Refs | Submodules | README

oakgen.lua (5481B)


      1 local self = MiniColors.as_colorscheme { name = "oak" }
      2 
      3 local base = MiniColors.convert('#E27950', 'oklch')
      4 
      5 local function colorn(t, clip)
      6   return MiniColors.convert({
      7     l = t.l or 68,
      8     h = t.h or t.n * (360 / 7) + base.h,
      9     c = t.c or base.c
     10   }, 'hex', { gamut_clip = clip or 'chroma' })
     11 end
     12 
     13 local new_bg = colorn { n = 0, l = 3.5 }
     14 local new_fg = colorn { n = 0, l = 95 }
     15 
     16 local palette = {
     17   bg = new_bg,
     18   dark = colorn { n = 0, l = 20, c = 5 },
     19   light = colorn { n = 0, l = 45, c = 5 },
     20   fg = new_fg,
     21   green = colorn { n = 2 },
     22   blue = colorn { n = 4 },
     23   orange = colorn { n = 0 },
     24   yellow = colorn { n = 1, l = 80 },
     25   red = colorn { h = 21, c = 23, l = 60 },
     26   kwcold = colorn { n = 5, c = 11 },
     27   funchot = colorn { n = 0 },
     28   string = colorn { n = 3 },
     29   type = colorn { n = 2 },
     30 }
     31 self.groups.Normal = { fg = palette.fg, bg = palette.bg }
     32 self.groups.Identifier = { link = 'Normal' }
     33 self.groups.Italic = { italic = true }
     34 self.groups.Bold = { bold = true }
     35 
     36 -- Tab line
     37 self.groups.TabLineSel = { bold = true }
     38 self.groups.TabLine = { bg = light }
     39 self.groups.TabLineFill = { link = 'TabLine' }
     40 
     41 self.groups.Search = { bg = palette.orange, fg = palette.bg }
     42 
     43 self.groups.MatchParen = { bg = palette.dark }
     44 self.groups.Visual = { bg = palette.dark }
     45 self.groups.LineNr = { fg = palette.light }
     46 self.groups.CursorLineNr = { bg = palette.dark }
     47 self.groups.StatusLine = { bg = palette.dark, bold = true, fg = palette.fg }
     48 self.groups.StatusLineNC = { bg = palette.dark, fg = palette.fg }
     49 self.groups.WinSeparator = { fg = palette.dark }
     50 self.groups.Pmenu = { bg = palette.dark }
     51 self.groups.PmenuSel = { bg = palette.light }
     52 self.groups.ColorColumn = { bg = palette.bg }
     53 self.groups.CursorColumn = { bg = palette.dark }
     54 self.groups.CursorLine = { bg = palette.dark }
     55 
     56 self.groups.Folded = { bg = palette.dark }
     57 
     58 self.groups.NonText = { fg = palette.dark }
     59 
     60 self.groups.Comment = { fg = palette.light, italic = true }
     61 self.groups.Special = { fg = palette.fg }
     62 self.groups["@namespace"] = { fg = palette.type }
     63 
     64 self.groups.Keyword = { fg = palette.kwcold }
     65 self.groups.Statement = { link = 'Keyword' }
     66 self.groups.Conditional = { link = 'Keyword' }
     67 self.groups.Operator = { link = 'Keyword' }
     68 self.groups.PreProc = { link = 'Keyword' }
     69 self.groups.Macro = { link = 'Keyword' }
     70 
     71 self.groups.Function = { fg = palette.funchot }
     72 
     73 self.groups.String = { fg = palette.string }
     74 
     75 self.groups.Number = { fg = palette.yellow }
     76 self.groups.Boolean = { fg = palette.yellow, bold = true }
     77 self.groups.Constant = { fg = palette.yellow, italic = true }
     78 
     79 self.groups.Type = { fg = palette.type, italic = true }
     80 self.groups.Char = { fg = palette.type }
     81 self.groups.SpecialChar = { fg = palette.type }
     82 self.groups.DiffAdd = { fg = palette.green }
     83 self.groups.DiffChange = { fg = palette.yellow }
     84 self.groups.DiffDelete = { fg = palette.red }
     85 
     86 self.groups.NormalFloat = { link = 'Normal' }
     87 self.groups.SignColumn = { link = 'Normal' }
     88 -- self.groups.NormalFloat = { bg = colorn { n = 4 } }
     89 
     90 local function diag(name, color)
     91   self.groups['Diagnostic' .. name] = { fg = color }
     92   self.groups['DiagnosticUnderline' .. name] = { sp = color, underline = true }
     93 end
     94 
     95 diag('Warn', palette.yellow)
     96 diag('Hint', palette.fg)
     97 diag('Info', palette.blue)
     98 self.groups.Error = { fg = palette.red }
     99 diag('Error', palette.red)
    100 self.groups.ErrorMsg = { link = 'Error' }
    101 self.groups.DiagnosticUnnecessary = { sp = palette.fg, underline = true }
    102 
    103 self.groups.Title = { fg = palette.orange }
    104 self.groups.Underlined = { fg = palette.fg, underline = true }
    105 self.groups.Todo = { link = 'Normal' }
    106 
    107 -- Spell groups
    108 self.groups.SpellBad = { sp = palette.red, undercurl = true }
    109 self.groups.SpellLocal = { link = 'SpellBad' }
    110 self.groups.SpellCap = { sp = palette.blue, undercurl = true }
    111 self.groups.SpellRare = { sp = palette.orange, undercurl = true }
    112 
    113 -- Tree sitter groups
    114 self.groups['@parameter'] = { fg = palette.fg, italic = true }
    115 self.groups['@text.reference'] = { fg = palette.yellow }
    116 self.groups['@text.environment'] = { link = 'Keyword' }
    117 self.groups['@text.environment.name'] = { fg = palette.light }
    118 self.groups['@text.emphasis'] = { italic = true }
    119 self.groups['@text.strong'] = { bold = true }
    120 self.groups['@punctuation.special'] = { fg = palette.light }
    121 self.groups['@attribute'] = { link = 'Keyword' }
    122 self.groups['@function.builtin'] = { fg = palette.light }
    123 self.groups['@constant.builtin'] = { fg = palette.light, bold = true }
    124 
    125 self.groups['@lsp.type.keyword'] = { link = '@keyword' }
    126 self.groups['@lsp.type.property'] = { link = '@property'}
    127 
    128 -- LSP groups
    129 self.groups.LspReferenceText = { sp = palette.orange, underline = true }
    130 self.groups.LspReferenceRead = { sp = palette.orange, underline = true }
    131 self.groups.LspReferenceWrite = { sp = palette.orange, underline = true }
    132 self.groups.LspInlayHint = { link = 'Comment' }
    133 
    134 --- Plugins
    135 
    136 -- Neogit
    137 self.groups.NeogitDiffAddHighlight = { link = 'DiffAdd' }
    138 self.groups.NeogitDiffDeleteHighlight = { link = 'DiffDelete' }
    139 
    140 -- self = self:resolve_links()
    141 self = self:compress()
    142 -- vim.print(palette)
    143 self = self:add_cterm_attributes()
    144 self = self:add_terminal_colors(false)
    145 
    146 local function set_term_color(nr, color)
    147   self.terminal[nr] = color
    148   self.terminal[nr + 8] = color
    149 end
    150 set_term_color(1, palette.red)
    151 set_term_color(2, palette.green)
    152 set_term_color(3, palette.yellow)
    153 set_term_color(4, palette.blue)
    154 set_term_color(5, palette.kwcold)
    155 self:write { name = 'oakv2' }
    156 
    157 -- vim.print(palette)
    158 self:apply()
    159 vim.print(self)