Skip to content

Feat/modernize #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 30 commits into
base: master
Choose a base branch
from
Draft

Feat/modernize #132

wants to merge 30 commits into from

Conversation

roosta
Copy link
Member

@roosta roosta commented Apr 10, 2025

Srcery Theme Modernization

This PR is an effort to modernize and normalize the srcery vim theme by cleaning up old code, standardizing color applications, and improving compatibility with both Vim and Neovim.

The current main has inconsistent coloring across languages, excessive highlight groups, and compatibility issues with newer features like Treesitter.

Changes

  • Use base color groups and links instead of defining each color individually.
    A function should look like a function in all languages where that makes sense.

  • Removed "memoize" groups (SrceryRed, SrceryBlack etc) that made debugging difficult (when :Inspect a highlight group, it would link to something like SrceryRed rather than a meaningful base group) (d2dd4cf)

  • Aligned Treesitter highlighting with traditional regex matching for consistent appearance

  • Removed a ton of highlight grops for languages and plugins. It should be assumed that mostly sane defaults should be enough,

  • Set xgray1 as NormalFloat, not defininig it is not an option

    NormalFloat keeps returning, causing issues. I tried not defining it at all,
    and see what nvim defaults to, but that resulted in some hard contrast
    black color. I checked with different themes if they define NormalFloat,
    at least in those I checked it was not, I even installed a couple and tried
    it, and it also defaulted to that same black color. Seems I have to define
    it if we want it to line up with other UI elements. I landed on xgray2,
    as it subtly stands out from the background, but not light enough to be
    distacting

  • Various group and link changes here and there, to many to keep track of, but I've tried to remain consisten. Things got a bit out of hand, so some of these commits aren't exactly atomic

Fixed

  • Fix an issue with nvimpager colors not using srcery, see 911a858 for details
  • Fix an issue with sneak, where a new group (SneakCurrent) needed to be linked to CurSearch, else it defaulted to hardcoded hex

Chore

  • Reorganize the code into more meaningful sections with less nesting/folding. I've also cleaned out a lot comments as well, a quick SHIFT+K will sooner explain the group better than most of those comments.

Note

There are probably issues I've not spotted, but also pleasant surprises here and there, where things work a bit more consistently. Some colors will probably be wrong to you, if you're anything like me, but I had to make some hard choices sometimes to bring things inline.

I don't plan on merging this for a bit, but please use it as your main colorscheme if you can, there's no better way of catching issues than using it, and I feel these changes are an improvement overall.

Eventually I'll rebase this, so don't worry about the messy commit history, it got a bit out of hand after a point.

TODOs

  • Screenshots
  • Documentation
  • Possibly removal of some old config options. Open for discussion here.

roosta added 30 commits April 7, 2025 23:18
Use the same defined heading colors for markdown and HTML, and what ever
else might need headings down the line
avante links to NormalFloat like so many others, in this cause it didn't
really work
It will link to `diffRemoved`, which only has `fg` defined, which in turn
would result in headings below a certain level would be red. I don't
know the rationale linking it to `diffRemoved`, maybe its common to add a
background to those groups, i do not know. In lue of colored background
shades I set it to `xgray1`, to simulate the effect I see in
`render-markdown` `readme` screenshots.
New group introduced that wasn't in sneak previously `SneakCurrent`, I
linked it to Search. I don't see any need to differentiate current and
other, cursor is already quite visible when using sneak, and if enabling
`set cursorline`, it's even more so.
Found 2 to be a bit too bright
Matches macro, which I think is appropriate
Keeping the underline, but differentate from normal text
For consistency, it was blue, not sure about what tree of links got it
there, but it was to much, while bright_white is too little.
String is bright green, feels more consistent
Had issues with colors being wrong in nvimpager for certain output, took
some serious digging to find any reference to these groups, and the
names are a bit odd, I checked the source and they are generated with
those names, but I'm worried it'll break, or additional groups are
needed.
Commented out groups I suspect aren't needed, but mainly moved stuff
around so it made a bit more sense, named sections and not so much
deeply nested folds. 1 level is enough IMO.

This is a larger effort to normalize the theme any rely on base language
groups for most syntax highlighting, making treesitter and regex similar
if not exactly the same.
The goal of this commit is to normalize all language hi groups. Instead
of specifying a color for each hi group, rely on defaults, or link to
base language groups. This makes for easier maintenance, and more
consistent colors. Keyword is keyword in any language that links to
keyword.

I've left links to basegroups if they were present before this
refactor, else I've tried to include sane links, but there will be large
differences from previous versions
This is a bad idea, when inspecting a hl group in nvim, it'll say that
it links to that group, which tells me nothing. For example, I'm
investigating why a certain word in a certain language looks the way it
looks, then inspecting the word, it'll say its linked to SrceryRed,
which is meaningless, I don't actually know which of the base groups are
being referenced, it would be any of those having SrceryRed as a base
color.

I fixed the lightline theme as well because it referenced the same
groups. We maintain global variables for color hexes, and the termcolors
are always the same so I just referenced those instead.
I kept some of the original bindings for reference where possible.
Setting type to italic by default, don't see a need to optionally set
this, we already have an italic toggle, and that should cover this as
well.
I think these mostly have been added so that we can reach the special
attr (bold, italic etc), but none is the correct way of getting to those
arguments

There are UI elements that have background set, not gonna touch those
for now.
Try to be consistent with ordering, function calls on top, links on
bottom. Sorted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant