diff --git a/lua/github-theme/palette/mappings.lua b/lua/github-theme/palette/mappings.lua new file mode 100644 index 00000000..093a6f1d --- /dev/null +++ b/lua/github-theme/palette/mappings.lua @@ -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