Skip to content

Commit

Permalink
fix(palette): incorrect colors/highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
tmillr committed May 23, 2023
1 parent 3f324ef commit 7a3691c
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions lua/github-theme/palette/mappings.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
-- Map prettylights colors json to nvim highlight groups. These mappings can be
-- done at ci time, build time, or runtime.
local api = vim.api

---@class github-theme.prettylights.syntax
---@field comment "#6e7781"
---@field constant "#0550ae"
---@field entity "#8250df"
---@field storageModifierImport "#24292f"
---@field entityTag "#116329"
---@field keyword "#cf222e"
---@field string "#0a3069"
---@field variable "#953800"
---@field brackethighlighterUnmatched "#82071e"
---@field invalidIllegalText "#f6f8fa"
---@field invalidIllegalBg "#82071e"
---@field carriageReturnText "#f6f8fa"
---@field carriageReturnBg "#cf222e"
---@field stringRegexp "#116329"
---@field markupList "#3b2300"
---@field markupHeading "#0550ae"
---@field markupItalic "#24292f"
---@field markupBold "#24292f"
---@field markupDeletedText "#82071e"
---@field markupDeletedBg "#ffebe9"
---@field markupInsertedText "#116329"
---@field markupInsertedBg "#dafbe1"
---@field markupChangedText "#953800"
---@field markupChangedBg "#ffd8b5"
---@field markupIgnoredText "#eaeef2"
---@field markupIgnoredBg "#0550ae"
---@field metaDiffRange "#8250df"
---@field brackethighlighterAngle "#57606a"
---@field sublimelinterGutterMark "#8c959f"
---@field constantOtherReferenceLink "#0a3069"

---@type { prettylights: { syntax: github-theme.prettylights.syntax } }
local prim = require('github-theme.palette.primitives.dark')

-- TODO: Handle rgb*() colors

-- TODO: finish this
-- In theory this could be automated instead of filling it out by-hand...but
-- it would probably require alot of work (in particular, resolving the way
-- in which GitHub's colors are mapped to each syntax item per language). Just
-- fill in by-hand for now. These mappings should be the same across different
-- colorschemes/themes, although there may be slight differences across
-- languages that still need to be accounted for (TODO).
local map = {}

map.global = {
Comment = prim.prettylights.syntax.comment,

---Constant any constant
---String a string constant: "this is a string"
---Character a character constant: 'c', '\n'
---Number a number constant: 234, 0xff
---Boolean a boolean constant: TRUE, false
---Float a floating point constant: 2.3e10
Constant = prim.prettylights.syntax.constant,

-- Params. TODO: in nvim, @parameter normally links to Identifier.
-- Prettylights does not have an Identifier group, and its `variable`
-- color is yellowish in dimmed theme and isn't used to highlight actual
-- variables most of the time (rather variables often go un-highlighted;
-- i.e. they have the default foreground color). Should we keep @parameter
-- linked to Identifier and then change Identifier to be un-highlighted?
-- Or, leave Identifier as mapped to `variable` from prettylights, but
-- break the link from `@parmeter` (and `@variable`) to Identifier?
-- ['@parameter'] = 'storageModifierImport',

entityTag = '',

String = prim.prettylights.syntax.string,

--- `@variable` and `@parameter` link to this.
variable = 'Identifier', -- TODO

---For function and method names within function and method declarations.
--`@function` and `@method` link to this.
Function = prim.prettylights.syntax.entity,

---Statement any statement
---Links
---Conditional if, then, else, endif, switch, etc.
---Repeat for, do, while, etc.
---Label case, default, etc.
---Operator "sizeof", "+", "*", etc.
---Keyword any other keyword—@keyword links to this
---Exception try, catch, throw
Statement = prim.prettylights.syntax.keyword,
}

map.c = { Operator = '' }
map.cpp = map.c

local function domap(a, b, c)
for key, value in pairs(assert(prettylights.syntax)) do
end
end

0 comments on commit 7a3691c

Please sign in to comment.