Skip to content
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

Make VimR tab colors match 1:1 with colorscheme. #1072

Merged
merged 1 commit into from
Jun 16, 2024

Conversation

s-daveb
Copy link
Contributor

@s-daveb s-daveb commented Jun 11, 2024

Background:

See issue #1069 - Themes with Hi groups using "links" to other Hi groups do not propagate colors to SwiftUI properly.

Description:

This pull requests further expands upon my previous PR, more closely setting the VimR tab colors to match the colors specified by the vim colors scheme.

Not only does it pull in the Tabline color definition, but it also pulls in TablineFill for the tabbar background, and TablineSel to highlight the current selected tab.

I've also tweaked the default colors selected when VimR is not set to use vim's color scheme, and have tested in both light and dark mode.

Please look over my PR and let me know if there are any mistakes that could lead to stability problems. So far

Additional Change:

I noticed a TODO: regarding the default color scheme when VimR is set to use the native Coacoa colors, and added a call to NSColor.Name() to select the user's chosen accent color from system settings.

One limitation of this change is that the VimR tab UI does not pick up on changes between Dark Mode and Light Mode. I considered polling the plist settings, but I would like to implement that with an event listener to prevent slow polling threads in the background. I am still doing research on how to do this.

For now, use either the Vim color scheme, or re-open the VimR window when changing the system them.

Screenshot 2024-06-10 at 6 36 00 PM

Screenshot 2024-06-10 at 6 36 08 PM

Screenshot 2024-06-10 at 6 36 16 PM

Screenshot 2024-06-10 at 6 36 23 PM

Additionally: Pick up system accent color properly when no colors set.

NvimView+Resize.swift:
  - Now transmitting Tabline, TablineFill  colors to the VimR
    UI, as well as TablineSel
  - Replace the built-in get() + nvim_get_hl() method because they don't
   have handle 'link' highlights properly (they return -1 for color code)
  - defined a new GetHiColor vimscript method that behaves like get()
       but also reads `link` type highlight groups by following the
       link.

NvimView+Types.swift:
  - visualForegroundColor is picked up from user accent color in System
    Settings using NSColor.Name("controlAccentColor")
  - Updated to include all additional colors

NvimView+UiBridge.swift:
 - Updated MessagePackUtils value code to accomodate new color code fields

Tabs/Tab.swift:
 - Get Selected tab color from TablineSel

Tabs/TabBar.swift:
 - Set tab bar color to TablineFill

Tabs/Theme.swift:
- Add new fields for TablineFill and TablineSel color corresponding to
  tab bar background and selected tab colors
- Minor rearranging of field order

VimR/Theme.swift:
- Add new fields for the tab bar, tab, and selected tab colors
@qvacua qvacua merged commit 82b6f33 into qvacua:master Jun 16, 2024
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.

2 participants