diff options
| author | Benjamin Linskey | 2026-06-03 14:09:08 -0400 |
|---|---|---|
| committer | Benjamin Linskey | 2026-06-07 16:20:24 -0400 |
| commit | 3b15f540431785c5c3c60957b9cf716899cdcaf5 (patch) | |
| tree | 627939bd6096c167b313b66eb77d39d04c6f41b4 | |
| download | halation.vim-3b15f540431785c5c3c60957b9cf716899cdcaf5.tar.gz | |
Add initial version
v0.1| -rw-r--r-- | Makefile | 10 | ||||
| -rw-r--r-- | README | 34 | ||||
| -rw-r--r-- | colors/halation.vim | 178 | ||||
| -rwxr-xr-x | scripts/preprocess | 53 | ||||
| -rwxr-xr-x | scripts/tpl | 55 | ||||
| -rw-r--r-- | template.vim | 177 | ||||
| -rw-r--r-- | vars | 61 |
7 files changed, 568 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..184536c --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +.POSIX: + +OUTFILE = colors/halation.vim + +$(OUTFILE): template.vim vars + scripts/preprocess template.vim | scripts/tpl vars - > $(OUTFILE) + +.PHONY: clean +clean: + rm $(OUTFILE) @@ -0,0 +1,34 @@ +This project simplifies the definition of color schemes by using a templating +system and a custom syntax for defining highlight groups. + +The template file `template.vim` is used to define the color scheme. +Template variables are defined in the `vars` file and can be used directly +in the template. + +Highlight groups can be defined using a simplified syntax: + + name foreground_color background_color terminal_attribute... + +All fields are separated by whitespace. Zero or more terminal_attribute values +may be defined. + +The `name` field should be the name of a Vim highlight group. If the first +letter of the group name is lower-case, the name in the template must be +preceeded by an underscore (so `gitcommitSummary` becomes `_gitcommitSummary` +in the template). + +The values of `foreground_color` and `background_color` must correspond to +variables defined in `var`. In addition, for each of those variable names, +there must be a corresponding variable with "_ansi" suffixed to its name. +The unsuffixed variables will be used for the `gui` color values and the +`_ansi` variables will be used for `cterm` values. + +Note that variable names used in the simplified highlight syntax must *not* be +surrounded by double braces. + +There is also a simplified syntax for linking highlight groups: + + name linked_group + +Again, `name` must be preceded by an underscore if it does not begin with +a capital letter. (Note that this is not the case for the `linked_group` name.) diff --git a/colors/halation.vim b/colors/halation.vim new file mode 100644 index 0000000..df70c5f --- /dev/null +++ b/colors/halation.vim @@ -0,0 +1,178 @@ +" halation colorscheme +" Maintainer: Benjamin Linskey <vim@linskey.org> +" Version: 0.1 +" URL: https://git.linskey.org/halation.vim + +" TODO: +" - Check cterm values. Probably missed some. +" - Clean up ctrlp bottom bar. +" - Alter links for flietypes that don't work well with current rules. + +highlight clear +set bg=dark +let g:colors_name="halation" + +if exists("syntax_on") + syntax reset +endif + +let g:terminal_ansi_colors = [ + \ "#111111", + \ "#E67E91", + \ "#68ADA8", + \ "#FAE3AC", + \ "#7C74B2", + \ "#E69BF2", + \ "#AFA5F7", + \ "#E8E8E8", + \ "#333333", + \ "#F26D85", + \ "#82BAB5", + \ "#FFEFC9", + \ "#2A254C", + \ "#F6BDFF", + \ "#413A77", + \ "#FFFFFF" +\ ] + +" Basic text and syntax groups +hi Normal guifg=#E8E8E8 ctermfg=7 guibg=NONE ctermbg=NONE cterm=NONE +hi Comment guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=NONE +hi Todo guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=bold +hi Underlined guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=underline +hi Bold guifg=#FFFFFF ctermfg=15 guibg=NONE ctermbg=NONE cterm=bold +hi Italic guifg=#E8E8E8 ctermfg=7 guibg=NONE ctermbg=NONE cterm=italic +hi BoldItalic guifg=#FFFFFF ctermfg=15 guibg=NONE ctermbg=NONE cterm=bold,italic +hi MatchParen guifg=#F6BDFF ctermfg=13 guibg=NONE ctermbg=NONE cterm=bold +hi Constant guifg=#E69BF2 ctermfg=5 guibg=NONE ctermbg=NONE cterm=NONE +hi String guifg=#FAE3AC ctermfg=3 guibg=NONE ctermbg=NONE cterm=NONE +hi PreProc guifg=#E67E91 ctermfg=1 guibg=NONE ctermbg=NONE cterm=NONE +hi! link Special Comment +hi! link Character Constant +hi! link Statement Normal +hi! link Identifier Normal +hi! link Type Normal +hi! link Tag Underlined + +" Errors and warnings +hi Error guifg=#E67E91 ctermfg=1 guibg=NONE ctermbg=NONE cterm=bold,underline +hi ErrorMsg guifg=#F26D85 ctermfg=9 guibg=NONE ctermbg=NONE cterm=bold +hi SpellBad guifg=#F26D85 ctermfg=9 guibg=NONE ctermbg=NONE cterm=underline +hi SpellCap guifg=#E69BF2 ctermfg=5 guibg=NONE ctermbg=NONE cterm=underline +hi SpellLocal guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=underline +hi SpellRare guifg=#82BAB5 ctermfg=10 guibg=NONE ctermbg=NONE cterm=underline +hi! link WarningMsg Error + +" Diff +hi Added guifg=#68ADA8 ctermfg=2 guibg=NONE ctermbg=NONE cterm=NONE +hi Removed guifg=#F26D85 ctermfg=9 guibg=NONE ctermbg=NONE cterm=NONE +hi Changed guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=NONE +hi DiffText guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=bold +hi! link DiffAdd Added +hi! link DiffChange Changed +hi! link DiffDelete Removed +hi! link DiffTextAdd DiffText + +" UI: Chrome +hi StatusLine guifg=#E8E8E8 ctermfg=7 guibg=#413A77 ctermbg=14 cterm=NONE +hi StatusLineNC guifg=#AFA5F7 ctermfg=6 guibg=#413A77 ctermbg=14 cterm=NONE +hi TabPanel guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=NONE +hi Title guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=NONE +hi VertSplit guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=NONE +hi TabLine guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=underline +hi! link VertSplitNC VertSplit +hi! link StatusLineTerm StatusLine +hi! link StatusLineTermNC StatusLineNC +hi! link TabLineFill TabLine +hi! link TabLineSel StatusLine +hi! link TabPanelFill TabPanel +hi! link TabPanelSel TabPanel +hi! link TitleBar StatusLine +hi! link TitleBarNC StatusLineNC + +" UI: Misc. +hi ColorColumn guifg=NONE ctermfg=NONE guibg=#2A254C ctermbg=12 cterm=NONE +hi Conceal guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=NONE +" TODO: These cursor values are just placeholders. +hi Cursor guifg=NONE ctermfg=NONE guibg=#413A77 ctermbg=14 cterm=NONE +hi lCursor guifg=NONE ctermfg=NONE guibg=#2A254C ctermbg=12 cterm=NONE +hi CursorColumn guifg=NONE ctermfg=NONE guibg=#2A254C ctermbg=12 cterm=NONE +hi Directory guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=bold +hi EndOfBuffer guifg=#7C74B2 ctermfg=4 guibg=NONE ctermbg=NONE cterm=NONE +hi Folded guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=bold,italic +hi IncSearch guifg=#FFEFC9 ctermfg=11 guibg=NONE ctermbg=NONE cterm=reverse +hi LineNr guifg=#7C74B2 ctermfg=4 guibg=NONE ctermbg=NONE cterm=NONE +hi CursorLineNr guifg=#F6BDFF ctermfg=13 guibg=NONE ctermbg=NONE cterm=bold +hi CursorLineFold guifg=#F6BDFF ctermfg=13 guibg=NONE ctermbg=NONE cterm=bold +hi CursorLineSign guifg=#F6BDFF ctermfg=13 guibg=NONE ctermbg=NONE cterm=bold +hi ModeMsg guifg=#E8E8E8 ctermfg=7 guibg=NONE ctermbg=NONE cterm=NONE +hi MsgArea guifg=#E8E8E8 ctermfg=7 guibg=NONE ctermbg=NONE cterm=NONE +hi MoreMsg guifg=#E8E8E8 ctermfg=7 guibg=NONE ctermbg=NONE cterm=bold +hi Question guifg=#AFA5F7 ctermfg=6 guibg=NONE ctermbg=NONE cterm=bold +hi QuickFixLine guifg=#E8E8E8 ctermfg=7 guibg=NONE ctermbg=NONE cterm=reverse +hi Visual guifg=NONE ctermfg=NONE guibg=#413A77 ctermbg=14 cterm=none +hi NonText guifg=#F6BDFF ctermfg=13 guibg=NONE ctermbg=NONE cterm=bold +hi! link CursorIM lCursor +hi! link CursorLine CursorColumn +hi! link FoldColumn Folded +hi! link SignColumn Folded +hi! link LineNrAbove LineNr +hi! link LineNrBelow LineNr +hi! link MessageWindow ErrorMsg +hi! link ComplMatchIns Normal +hi! link PreInsert Added +hi! link Search IncSearch +hi! link CurSearch Search +hi! link SpecialKey EndOfBuffer +hi! link Terminal Normal +hi! link VisualNOS Visual +hi! link WildMenu PMenuSel + +" UI: Pop-up menus +hi PMenu guifg=#E8E8E8 ctermfg=7 guibg=#413A77 ctermbg=14 cterm=NONE +hi PMenuSel guifg=#413A77 ctermfg=14 guibg=#AFA5F7 ctermbg=6 cterm=bold +hi PMenuSbar guifg=#E8E8E8 ctermfg=7 guibg=#E8E8E8 ctermbg=7 cterm=NONE +hi PMenuThumb guifg=#E8E8E8 ctermfg=7 guibg=#AFA5F7 ctermbg=6 cterm=NONE +hi PMenuShadow guifg=#333333 ctermfg=8 guibg=NONE ctermbg=NONE cterm=NONE +hi! link PMenuKind PMenu +hi! link PMenuKindSel PMenuSel +hi! link PMenuExtra PMenu +hi! link PMenuExtraSel PMenuSel +hi! link PMenuMatch PMenu +hi! link PMenumatchSel PMenuSel +hi! link PMenuborder PMenu +hi! link Popup Pmenu +hi! link PopupBorder Pmenu +hi! link PopupTitle Pmenu +hi! link PopupSelected PmenuSel +hi! link PopupNotification WarningMsg + +hi! link gitcommitSummary Normal +hi! link gitcommitOverflow Error + +hi! link HtmlH1 Normal +hi! link HtmlH2 HtmlH1 +hi! link HtmlH3 HtmlH1 +hi! link HtmlH4 HtmlH1 +hi! link HtmlH5 HtmlH1 +hi! link HtmlH6 HtmlH1 +hi! link HtmlLink Normal +hi! link HtmlTitle Normal + +hi! link MarkdownH1 String +hi! link MarkdownH2 MarkdownH1 +hi! link MarkdownH3 MarkdownH1 +hi! link MarkdownH4 MarkdownH1 +hi! link MarkdownH5 MarkdownH1 +hi! link MarkdownH6 MarkdownH1 +hi! link MarkdownLinkText Type +hi! link MarkdownId Comment +hi! link MarkdownUrl MarkdownId +hi! link markdownCode PreProc + +" ALE +hi ALEWarning guifg=#FAE3AC ctermfg=3 guibg=NONE ctermbg=NONE cterm=bold,bold,underline +hi ALEInfo guifg=#7C74B2 ctermfg=4 guibg=NONE ctermbg=NONE cterm=bold,underline +hi! link ALEError Error +hi! link ALEStyleError ALEError +hi! link ALEStyleWarning ALEWarning diff --git a/scripts/preprocess b/scripts/preprocess new file mode 100755 index 0000000..63e6604 --- /dev/null +++ b/scripts/preprocess @@ -0,0 +1,53 @@ +#!/usr/bin/awk -f + +function ansi(s) { + if (s == "none" || s == "NONE") { + return s + } + + return s "_ansi" +} + +function tpl(s) { + if (s == "none" || s == "NONE") { + return "NONE" + } + + return "{{ " s " }}" +} + +function strip_underscore(s) { + if (substr(s, 1, 1) == "_") { + return substr(s, 2) + } + + return s +} + +/^#/ { $0 = "\"" substr($0, 2) } + +/^[_[:upper:]]/ && NF == 3 { + $0 = "hi " strip_underscore($1) " guifg=" tpl($2) \ + " ctermfg=" tpl(ansi($2)) " guibg=" tpl($3) \ + " ctermbg=" tpl(ansi($3)) " cterm=NONE" +} + +/^[_[:upper:]]/ && NF > 3 { + line = "hi " strip_underscore($1) " guifg=" tpl($2) \ + " ctermfg=" tpl(ansi($2)) " guibg=" tpl($3) \ + " ctermbg=" tpl(ansi($3)) " cterm=" + + for (i=4; i <= NF; i++) { + line = line $i + + if (i < NF) { + line = line "," + } + } + + $0 = line +} + +/^[_[:upper:]]/ && NF == 2 { $0 = "hi! link " strip_underscore($1) " " $2 } + +{ print } diff --git a/scripts/tpl b/scripts/tpl new file mode 100755 index 0000000..4a27c65 --- /dev/null +++ b/scripts/tpl @@ -0,0 +1,55 @@ +#!/usr/bin/awk -f + +# Copyright (c) 2026 Benjamin Linskey <contact@linskey.org> +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +# tpl: An extremely simple general-purpose templating tool. +# +# Version 1.0.0 +# +# Usage: tpl [variable file] [template file...] +# +# More info: https://git.linskey.org/tpl + +BEGIN { FS = "[[:space:]]*=[[:space:]]*" } + +FILENAME == ARGV[1] && /^#/ { next } +FILENAME == ARGV[1] && NF == 2 { + # Replace template variables with previously defined values. + while (match($2, /\{\{[[:space:]]*[^\{\}[:space:]]+[[:space:]]\}\}/)) { + matched_text = substr($2, RSTART, RLENGTH) + + # Extract the actual var name, without braces and space. + match(matched_text, /[^\{\}[:space:]]+/) + var_name = substr(matched_text, RSTART, RLENGTH) + + # Even though matched_text contains the { and } regex + # metacharacters, we don't need to escape them because they're + # not used in a way that matches the (r){m,n} syntax. + # (We don't need to escape them elsewhere in this program + # either, but we do so for maximum clarity.) + sub(matched_text, vals[var_name], $2) + } + + vals[$1] = $2 +} +FILENAME == ARGV[1] { next } + +/\{\{[[:space:]]*[^\{\}[:space:]]+[[:space:]]*\}\}/ { + for (key in vals) { + gsub("\{\{[[:space:]]*" key "[[:space:]]*\}\}", vals[key]) + } +} + +{ print } diff --git a/template.vim b/template.vim new file mode 100644 index 0000000..3b05d13 --- /dev/null +++ b/template.vim @@ -0,0 +1,177 @@ +" {{title}} +" Maintainer: {{maintainer}} +" Version: {{version}} +" URL: {{url}} + +" TODO: +" - Clean up ctrlp bottom bar. +" - Alter links for filetypes that don't work well with current rules. + +highlight clear +set bg={{bg_setting}} +let g:colors_name="{{name}}" + +if exists("syntax_on") + syntax reset +endif + +let g:terminal_ansi_colors = [ + \ "{{black}}", + \ "{{red}}", + \ "{{green}}", + \ "{{yellow}}", + \ "{{dark_purple}}", + \ "{{pink}}", + \ "{{light_purple}}", + \ "{{white}}", + \ "{{gray}}", + \ "{{bold_red}}", + \ "{{light_green}}", + \ "{{light_yellow}}", + \ "{{dark_ui_purple}}", + \ "{{light_pink}}", + \ "{{light_ui_purple}}", + \ "{{bright_white}}" +\ ] + +" Basic text and syntax groups +Normal white bg +Comment light_purple bg +Todo light_purple bg bold +Underlined light_purple bg underline +Bold bright_white bg bold +Italic white bg italic +BoldItalic bright_white bg bold italic +MatchParen light_pink bg bold +Constant pink bg +String yellow bg +PreProc red bg +Special Comment +Character Constant +Statement Normal +Identifier Normal +Type Normal +Tag Underlined + +" Errors and warnings +Error red none bold underline +ErrorMsg bold_red bg bold +SpellBad bold_red bg underline +SpellCap pink bg underline +SpellLocal light_purple bg underline +SpellRare light_green bg underline +WarningMsg Error + +" Diff +Added green bg +Removed bold_red bg +Changed light_purple bg +DiffText light_purple bg bold +DiffAdd Added +DiffChange Changed +DiffDelete Removed +DiffTextAdd DiffText + +" UI: Chrome +StatusLine white light_ui_purple +StatusLineNC light_purple light_ui_purple +TabPanel light_purple bg +Title light_purple bg +VertSplit light_purple bg +TabLine light_purple bg underline +VertSplitNC VertSplit +StatusLineTerm StatusLine +StatusLineTermNC StatusLineNC +TabLineFill TabLine +TabLineSel StatusLine +TabPanelFill TabPanel +TabPanelSel TabPanel +TitleBar StatusLine +TitleBarNC StatusLineNC + +" UI: Misc. +ColorColumn none dark_ui_purple +Conceal light_purple bg +" TODO: These cursor values are just placeholders. +Cursor none light_ui_purple +_lCursor none dark_ui_purple +CursorColumn none bg_tint +Directory light_purple bg bold +EndOfBuffer dark_purple bg +Folded light_purple bg bold italic +IncSearch light_yellow bg reverse +LineNr dark_purple bg +CursorLineNr light_pink bg bold +CursorLineFold light_pink bg bold +CursorLineSign light_pink bg bold +ModeMsg white bg +MsgArea white bg +MoreMsg white bg bold +Question light_purple bg bold +QuickFixLine white bg reverse +Visual none light_ui_purple none +NonText light_pink bg bold +CursorIM lCursor +CursorLine CursorColumn +FoldColumn Folded +SignColumn Folded +LineNrAbove LineNr +LineNrBelow LineNr +MessageWindow ErrorMsg +ComplMatchIns Normal +PreInsert Added +Search IncSearch +CurSearch Search +SpecialKey EndOfBuffer +Terminal Normal +VisualNOS Visual +WildMenu PMenuSel + +" UI: Pop-up menus +PMenu white light_ui_purple +PMenuSel light_ui_purple light_purple bold +PMenuSbar white white +PMenuThumb white light_purple +PMenuShadow gray bg +PMenuKind PMenu +PMenuKindSel PMenuSel +PMenuExtra PMenu +PMenuExtraSel PMenuSel +PMenuMatch PMenu +PMenumatchSel PMenuSel +PMenuborder PMenu +Popup Pmenu +PopupBorder Pmenu +PopupTitle Pmenu +PopupSelected PmenuSel +PopupNotification WarningMsg + +_gitcommitSummary Normal +_gitcommitOverflow Error + +HtmlH1 Normal +HtmlH2 HtmlH1 +HtmlH3 HtmlH1 +HtmlH4 HtmlH1 +HtmlH5 HtmlH1 +HtmlH6 HtmlH1 +HtmlLink Normal +HtmlTitle Normal + +MarkdownH1 String +MarkdownH2 MarkdownH1 +MarkdownH3 MarkdownH1 +MarkdownH4 MarkdownH1 +MarkdownH5 MarkdownH1 +MarkdownH6 MarkdownH1 +MarkdownLinkText Type +MarkdownId Comment +MarkdownUrl MarkdownId +_markdownCode PreProc + +" ALE +ALEWarning yellow none bold bold underline +ALEInfo dark_purple none bold underline +ALEError Error +ALEStyleError ALEError +ALEStyleWarning ALEWarning @@ -0,0 +1,61 @@ +title = halation colorscheme +maintainer = Benjamin Linskey <vim@linskey.org> +url = https://git.linskey.org/halation.vim +bg_setting = dark +name = halation +version = 0.1 + +# ANSI color palette +# +# In addition to being used for the g_terminal_ansi_colors variable, these are +# the principal colors used for 24-bit values in the Vim color scheme. They +# don't strictly adhere to the ANSI color names. Most notably, we put some of +# the dark colors in the "bright" 8-15 range so that 0-7 contains our most +# readable text colors, minimizing the chance that a program outputs unreadable +# dark-purple-on-black text. +black = #111111 +red = #E67E91 +green = #68ADA8 +yellow = #FAE3AC +dark_purple = #7C74B2 +pink = #E69BF2 +light_purple = #AFA5F7 +white = #E8E8E8 +gray = #333333 +bold_red = #F26D85 +light_green = #82BAB5 +light_yellow = #FFEFC9 +dark_ui_purple = #2A254C +light_pink = #F6BDFF +light_ui_purple = #413A77 +bright_white = #FFFFFF + +# 16-color version of the above palette for use in cterm values +black_ansi = 0 +red_ansi = 1 +green_ansi = 2 +yellow_ansi = 3 +dark_purple_ansi = 4 +pink_ansi = 5 +light_purple_ansi = 6 +white_ansi = 7 +gray_ansi = 8 +bold_red_ansi = 9 +light_green_ansi = 10 +light_yellow_ansi = 11 +dark_ui_purple_ansi = 12 +light_pink_ansi = 13 +light_ui_purple_ansi = 14 +bright_white_ansi = 15 + +# This causes Vim to use the terminal's background color, which allows +# transparent backgrounds to work properly. This color scheme is designed +# with the assumption that the color is something close to the black value +# defined above. +bg = NONE +bg_ansi = {{ bg }} + +# TOD: Improve this and figure out what to do for ansi. +# This is used for cursorline and cursorcolumn. +bg_tint = {{ dark_ui_purple }} +bg_tint_ansi = {{ dark_ui_purple_ansi }} |