1#ifndef NVIM_HIGHLIGHT_DEFS_H
2#define NVIM_HIGHLIGHT_DEFS_H
3
4#include <inttypes.h>
5
6#include "nvim/macros.h"
7
8typedef int32_t RgbValue;
9
10/// Highlighting attribute bits.
11///
12/// sign bit should not be used here, as it identifies invalid highlight
13typedef enum {
14 HL_INVERSE = 0x01,
15 HL_BOLD = 0x02,
16 HL_ITALIC = 0x04,
17 HL_UNDERLINE = 0x08,
18 HL_UNDERCURL = 0x10,
19 HL_STANDOUT = 0x20,
20 HL_STRIKETHROUGH = 0x40,
21} HlAttrFlags;
22
23/// Stores a complete highlighting entry, including colors and attributes
24/// for both TUI and GUI.
25typedef struct attr_entry {
26 int16_t rgb_ae_attr, cterm_ae_attr; ///< HlAttrFlags
27 RgbValue rgb_fg_color, rgb_bg_color, rgb_sp_color;
28 int cterm_fg_color, cterm_bg_color;
29 int hl_blend;
30} HlAttrs;
31
32#define HLATTRS_INIT (HlAttrs) { \
33 .rgb_ae_attr = 0, \
34 .cterm_ae_attr = 0, \
35 .rgb_fg_color = -1, \
36 .rgb_bg_color = -1, \
37 .rgb_sp_color = -1, \
38 .cterm_fg_color = 0, \
39 .cterm_bg_color = 0, \
40 .hl_blend = -1, \
41}
42
43/// Values for index in highlight_attr[].
44/// When making changes, also update hlf_names below!
45typedef enum {
46 HLF_8 = 0 // Meta & special keys listed with ":map", text that is
47 // displayed different from what it is
48 , HLF_EOB // after the last line in the buffer
49 , HLF_TERM // terminal cursor focused
50 , HLF_TERMNC // terminal cursor unfocused
51 , HLF_AT // @ characters at end of screen, characters that
52 // don't really exist in the text
53 , HLF_D // directories in CTRL-D listing
54 , HLF_E // error messages
55 , HLF_I // incremental search
56 , HLF_L // last search string
57 , HLF_M // "--More--" message
58 , HLF_CM // Mode (e.g., "-- INSERT --")
59 , HLF_N // line number for ":number" and ":#" commands
60 , HLF_CLN // current line number
61 , HLF_R // return to continue message and yes/no questions
62 , HLF_S // status lines
63 , HLF_SNC // status lines of not-current windows
64 , HLF_C // column to separate vertically split windows
65 , HLF_T // Titles for output from ":set all", ":autocmd" etc.
66 , HLF_V // Visual mode
67 , HLF_VNC // Visual mode, autoselecting and not clipboard owner
68 , HLF_W // warning messages
69 , HLF_WM // Wildmenu highlight
70 , HLF_FL // Folded line
71 , HLF_FC // Fold column
72 , HLF_ADD // Added diff line
73 , HLF_CHD // Changed diff line
74 , HLF_DED // Deleted diff line
75 , HLF_TXD // Text Changed in diff line
76 , HLF_SC // Sign column
77 , HLF_CONCEAL // Concealed text
78 , HLF_SPB // SpellBad
79 , HLF_SPC // SpellCap
80 , HLF_SPR // SpellRare
81 , HLF_SPL // SpellLocal
82 , HLF_PNI // popup menu normal item
83 , HLF_PSI // popup menu selected item
84 , HLF_PSB // popup menu scrollbar
85 , HLF_PST // popup menu scrollbar thumb
86 , HLF_TP // tabpage line
87 , HLF_TPS // tabpage line selected
88 , HLF_TPF // tabpage line filler
89 , HLF_CUC // 'cursorcolumn'
90 , HLF_CUL // 'cursorline'
91 , HLF_MC // 'colorcolumn'
92 , HLF_QFL // selected quickfix line
93 , HLF_0 // Whitespace
94 , HLF_INACTIVE // NormalNC: Normal text in non-current windows
95 , HLF_MSGSEP // message separator line
96 , HLF_NFLOAT // Floating window
97 , HLF_MSG // Message area
98 , HLF_COUNT // MUST be the last one
99} hlf_T;
100
101EXTERN const char *hlf_names[] INIT(= {
102 [HLF_8] = "SpecialKey",
103 [HLF_EOB] = "EndOfBuffer",
104 [HLF_TERM] = "TermCursor",
105 [HLF_TERMNC] = "TermCursorNC",
106 [HLF_AT] = "NonText",
107 [HLF_D] = "Directory",
108 [HLF_E] = "ErrorMsg",
109 [HLF_I] = "IncSearch",
110 [HLF_L] = "Search",
111 [HLF_M] = "MoreMsg",
112 [HLF_CM] = "ModeMsg",
113 [HLF_N] = "LineNr",
114 [HLF_CLN] = "CursorLineNr",
115 [HLF_R] = "Question",
116 [HLF_S] = "StatusLine",
117 [HLF_SNC] = "StatusLineNC",
118 [HLF_C] = "VertSplit",
119 [HLF_T] = "Title",
120 [HLF_V] = "Visual",
121 [HLF_VNC] = "VisualNC",
122 [HLF_W] = "WarningMsg",
123 [HLF_WM] = "WildMenu",
124 [HLF_FL] = "Folded",
125 [HLF_FC] = "FoldColumn",
126 [HLF_ADD] = "DiffAdd",
127 [HLF_CHD] = "DiffChange",
128 [HLF_DED] = "DiffDelete",
129 [HLF_TXD] = "DiffText",
130 [HLF_SC] = "SignColumn",
131 [HLF_CONCEAL] = "Conceal",
132 [HLF_SPB] = "SpellBad",
133 [HLF_SPC] = "SpellCap",
134 [HLF_SPR] = "SpellRare",
135 [HLF_SPL] = "SpellLocal",
136 [HLF_PNI] = "Pmenu",
137 [HLF_PSI] = "PmenuSel",
138 [HLF_PSB] = "PmenuSbar",
139 [HLF_PST] = "PmenuThumb",
140 [HLF_TP] = "TabLine",
141 [HLF_TPS] = "TabLineSel",
142 [HLF_TPF] = "TabLineFill",
143 [HLF_CUC] = "CursorColumn",
144 [HLF_CUL] = "CursorLine",
145 [HLF_MC] = "ColorColumn",
146 [HLF_QFL] = "QuickFixLine",
147 [HLF_0] = "Whitespace",
148 [HLF_INACTIVE] = "NormalNC",
149 [HLF_MSGSEP] = "MsgSeparator",
150 [HLF_NFLOAT] = "NormalFloat",
151 [HLF_MSG] = "MsgArea",
152});
153
154
155EXTERN int highlight_attr[HLF_COUNT]; // Highl. attr for each context.
156EXTERN int highlight_attr_last[HLF_COUNT]; // copy for detecting changed groups
157EXTERN int highlight_user[9]; // User[1-9] attributes
158EXTERN int highlight_stlnc[9]; // On top of user
159EXTERN int cterm_normal_fg_color INIT(= 0);
160EXTERN int cterm_normal_bg_color INIT(= 0);
161EXTERN RgbValue normal_fg INIT(= -1);
162EXTERN RgbValue normal_bg INIT(= -1);
163EXTERN RgbValue normal_sp INIT(= -1);
164
165typedef enum {
166 kHlUnknown,
167 kHlUI,
168 kHlSyntax,
169 kHlTerminal,
170 kHlCombine,
171 kHlBlend,
172 kHlBlendThrough,
173} HlKind;
174
175typedef struct {
176 HlAttrs attr;
177 HlKind kind;
178 int id1;
179 int id2;
180} HlEntry;
181
182#endif // NVIM_HIGHLIGHT_DEFS_H
183