|
| 1 | +-- Map prettylights colors json to nvim highlight groups. These mappings can be |
| 2 | +-- done at ci time, build time, or runtime. |
| 3 | +local api = vim.api |
| 4 | + |
| 5 | +---@class github-theme.prettylights.syntax |
| 6 | +---@field comment "#6e7781" |
| 7 | +---@field constant "#0550ae" |
| 8 | +---@field entity "#8250df" |
| 9 | +---@field storageModifierImport "#24292f" |
| 10 | +---@field entityTag "#116329" |
| 11 | +---@field keyword "#cf222e" |
| 12 | +---@field string "#0a3069" |
| 13 | +---@field variable "#953800" |
| 14 | +---@field brackethighlighterUnmatched "#82071e" |
| 15 | +---@field invalidIllegalText "#f6f8fa" |
| 16 | +---@field invalidIllegalBg "#82071e" |
| 17 | +---@field carriageReturnText "#f6f8fa" |
| 18 | +---@field carriageReturnBg "#cf222e" |
| 19 | +---@field stringRegexp "#116329" |
| 20 | +---@field markupList "#3b2300" |
| 21 | +---@field markupHeading "#0550ae" |
| 22 | +---@field markupItalic "#24292f" |
| 23 | +---@field markupBold "#24292f" |
| 24 | +---@field markupDeletedText "#82071e" |
| 25 | +---@field markupDeletedBg "#ffebe9" |
| 26 | +---@field markupInsertedText "#116329" |
| 27 | +---@field markupInsertedBg "#dafbe1" |
| 28 | +---@field markupChangedText "#953800" |
| 29 | +---@field markupChangedBg "#ffd8b5" |
| 30 | +---@field markupIgnoredText "#eaeef2" |
| 31 | +---@field markupIgnoredBg "#0550ae" |
| 32 | +---@field metaDiffRange "#8250df" |
| 33 | +---@field brackethighlighterAngle "#57606a" |
| 34 | +---@field sublimelinterGutterMark "#8c959f" |
| 35 | +---@field constantOtherReferenceLink "#0a3069" |
| 36 | + |
| 37 | +---@type { prettylights: { syntax: github-theme.prettylights.syntax } } |
| 38 | +local prim = require('github-theme.palette.primitives.dark') |
| 39 | + |
| 40 | +-- TODO: Handle rgb*() colors |
| 41 | + |
| 42 | +-- TODO: finish this |
| 43 | +-- In theory this could be automated instead of filling it out by-hand...but |
| 44 | +-- it would probably require alot of work (in particular, resolving the way |
| 45 | +-- in which GitHub's colors are mapped to each syntax item per language). Just |
| 46 | +-- fill in by-hand for now. These mappings should be the same across different |
| 47 | +-- colorschemes/themes, although there may be slight differences across |
| 48 | +-- languages that still need to be accounted for (TODO). |
| 49 | +local map = {} |
| 50 | + |
| 51 | +map.global = { |
| 52 | + Comment = prim.prettylights.syntax.comment, |
| 53 | + |
| 54 | + ---Constant any constant |
| 55 | + ---String a string constant: "this is a string" |
| 56 | + ---Character a character constant: 'c', '\n' |
| 57 | + ---Number a number constant: 234, 0xff |
| 58 | + ---Boolean a boolean constant: TRUE, false |
| 59 | + ---Float a floating point constant: 2.3e10 |
| 60 | + Constant = prim.prettylights.syntax.constant, |
| 61 | + |
| 62 | + -- Params. TODO: in nvim, @parameter normally links to Identifier. |
| 63 | + -- Prettylights does not have an Identifier group, and its `variable` |
| 64 | + -- color is yellowish in dimmed theme and isn't used to highlight actual |
| 65 | + -- variables most of the time (rather variables often go un-highlighted; |
| 66 | + -- i.e. they have the default foreground color). Should we keep @parameter |
| 67 | + -- linked to Identifier and then change Identifier to be un-highlighted? |
| 68 | + -- Or, leave Identifier as mapped to `variable` from prettylights, but |
| 69 | + -- break the link from `@parmeter` (and `@variable`) to Identifier? |
| 70 | + -- ['@parameter'] = 'storageModifierImport', |
| 71 | + |
| 72 | + entityTag = '', |
| 73 | + |
| 74 | + String = prim.prettylights.syntax.string, |
| 75 | + |
| 76 | + --- `@variable` and `@parameter` link to this. |
| 77 | + variable = 'Identifier', -- TODO |
| 78 | + |
| 79 | + ---For function and method names within function and method declarations. |
| 80 | + --`@function` and `@method` link to this. |
| 81 | + Function = prim.prettylights.syntax.entity, |
| 82 | + |
| 83 | + ---Statement any statement |
| 84 | + ---Links |
| 85 | + ---Conditional if, then, else, endif, switch, etc. |
| 86 | + ---Repeat for, do, while, etc. |
| 87 | + ---Label case, default, etc. |
| 88 | + ---Operator "sizeof", "+", "*", etc. |
| 89 | + ---Keyword any other keyword—@keyword links to this |
| 90 | + ---Exception try, catch, throw |
| 91 | + Statement = prim.prettylights.syntax.keyword, |
| 92 | +} |
| 93 | + |
| 94 | +map.c = { Operator = '' } |
| 95 | +map.cpp = map.c |
| 96 | + |
| 97 | +local function domap(a, b, c) |
| 98 | + for key, value in pairs(assert(prettylights.syntax)) do |
| 99 | + end |
| 100 | +end |
0 commit comments