1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-09-11 17:15:34 +03:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Tae Won Ha
495ec31f9e
Update release notes 2024-05-17 08:52:25 +02:00
Tae Won Ha
129173b04e
Merge pull request #1059 from s-daveb/master
Modify theming code: custom tab theme is now pulled from TablineSel highlight group
2024-05-17 08:50:41 +02:00
S David
949022ee88 Reverting accidental changes to TabSupport/../MainMenu.xib 2024-05-15 14:18:32 -04:00
S David
c1b42135b2 Use tabForeground color for selected tab close icon, and regular text foreground color for unselected tabs 2024-05-15 14:13:36 -04:00
S David
4666d1b4ac Modify VimR's themeing. Custom Tab color comes from TablineSel color group rather than Visual selection background color.
Fixes the issue where the everforest theme results in low-contrast tabs, by using color groups that were meant for tabs
2024-05-06 15:02:07 -04:00
8 changed files with 32 additions and 13 deletions

View File

@ -126,7 +126,7 @@ extension NvimView {
let g:gui_vimr = 1
autocmd VimLeave * call rpcnotify(\(channel), 'autocommand', 'vimleave')
autocmd VimEnter * call rpcnotify(\(channel), 'autocommand', 'vimenter')
autocmd ColorScheme * call rpcnotify(\(channel), 'autocommand', 'colorscheme', get(nvim_get_hl(0, {'id': hlID('Normal')}), 'fg', -1), get(nvim_get_hl(0, {'id': hlID('Normal')}), 'bg', -1), get(nvim_get_hl(0, {'id': hlID('Visual')}), 'fg', -1), get(nvim_get_hl(0, {'id': hlID('Visual')}), 'bg', -1), get(nvim_get_hl(0, {'id': hlID('Directory')}), 'fg', -1))
autocmd ColorScheme * call rpcnotify(\(channel), 'autocommand', 'colorscheme', get(nvim_get_hl(0, {'id': hlID('Normal')}), 'fg', -1), get(nvim_get_hl(0, {'id': hlID('Normal')}), 'bg', -1), get(nvim_get_hl(0, {'id': hlID('Visual')}), 'fg', -1), get(nvim_get_hl(0, {'id': hlID('Visual')}), 'bg', -1), get(nvim_get_hl(0, {'id': hlID('Directory')}), 'fg', -1), get(nvim_get_hl(0, {'id': hlID('TablineSel')}), 'bg', -1), get(nvim_get_hl(0, {'id': hlID('TablineSel')}), 'fg', -1))
autocmd VimEnter * call rpcrequest(\(channel), 'vimenter')
""", opts: [:], errWhenBlocked: false)
// swiftformat:enable all

View File

@ -101,11 +101,14 @@ public extension NvimView {
public var visualBackground = NSColor.selectedContentBackgroundColor
public var directoryForeground = NSColor.textColor
public var tabForeground = NSColor.textColor
public var tabBackground = NSColor.textBackgroundColor
public init() {}
public init(_ values: [Int]) {
if values.count < 5 { preconditionFailure("We need 5 colors!") }
if values.count < 7 { preconditionFailure("We need 7 colors!") }
let color = ColorUtils.colorIgnoringAlpha
@ -118,12 +121,15 @@ public extension NvimView {
self.directoryForeground = values[4] < 0
? Theme.default.directoryForeground
: color(values[4])
self.tabBackground = values[5] < 0 ? Theme.default.background : color(values[5])
self.tabForeground = values[6] < 0 ? Theme.default.foreground : color(values[6])
}
public var description: String {
"NVV.Theme<" +
"fg: \(self.foreground.hex), bg: \(self.background.hex), " +
"visual-fg: \(self.visualForeground.hex), visual-bg: \(self.visualBackground.hex)" +
"tab-fg: \(self.tabForeground.hex), tab-bg: \(self.tabBackground.hex)" +
">"
}
}

View File

@ -511,7 +511,7 @@ extension NvimView {
private func colorSchemeChanged(_ value: MessagePackValue) {
guard let values = MessagePackUtils.array(
from: value, ofSize: 5, conversion: { $0.intValue }
from: value, ofSize: 7, conversion: { $0.intValue }
) else {
self.bridgeLogger.error("Could not convert \(value)")
return

View File

@ -107,8 +107,8 @@ extension Tab {
private func adjustColors(_ newIsSelected: Bool) {
if newIsSelected {
self.layer?.backgroundColor = self.theme.selectedBackgroundColor.cgColor
self.titleView.textColor = self.theme.selectedForegroundColor
self.layer?.backgroundColor = self.theme.tabBackgroundColor.cgColor
self.titleView.textColor = self.theme.tabForegroundColor
self.closeButton.image = self.theme.selectedCloseButtonImage
} else {
self.layer?.backgroundColor = self.theme.backgroundColor.cgColor

View File

@ -25,15 +25,17 @@ public struct Theme {
didSet {
self.selectedCloseButtonImage = Icon.close.asImage(
dimension: self.iconDimension.width,
color: self.selectedForegroundColor
color: self.tabForegroundColor
)
}
}
public var selectedBackgroundColor = NSColor.selectedTextBackgroundColor
public var tabSelectedIndicatorColor = NSColor.selectedTextColor
public var tabBackgroundColor = NSColor.selectedTextBackgroundColor
public var tabForegroundColor = NSColor.selectedTextColor
public var titleFont = NSFont.systemFont(ofSize: 11)
public var selectedTitleFont = NSFont.boldSystemFont(ofSize: 11)
@ -58,12 +60,12 @@ public struct Theme {
public init() {
self.closeButtonImage = Icon.close.asImage(
dimension: self.iconDimension.width,
color: self.foregroundColor
color: self.tabForegroundColor
)
self.selectedCloseButtonImage = Icon.close.asImage(
dimension: self.iconDimension.width,
color: self.selectedForegroundColor
color: self.tabForegroundColor
)
}
}

View File

@ -482,6 +482,9 @@ final class MainWindow: NSObject,
tabsTheme.selectedForegroundColor = self.theme.highlightForeground
tabsTheme.selectedBackgroundColor = self.theme.highlightBackground
tabsTheme.tabBackgroundColor = self.theme.tabBackground;
tabsTheme.tabForegroundColor = self.theme.tabForeground;
tabsTheme.tabSelectedIndicatorColor = self.theme.highlightForeground

View File

@ -45,6 +45,9 @@ struct Theme: CustomStringConvertible {
var highlightBackground = NSColor.selectedContentBackgroundColor
var directoryForeground = NSColor.textColor
var tabForeground = NSColor.selectedMenuItemTextColor
var tabBackground = NSColor.selectedContentBackgroundColor
var cssColor = NSColor(hex: "24292e")!
var cssBackgroundColor = NSColor.white
@ -62,7 +65,8 @@ struct Theme: CustomStringConvertible {
"Theme<" +
"fg: \(self.foreground.hex), bg: \(self.background.hex), " +
"hl-fg: \(self.highlightForeground.hex), hl-bg: \(self.highlightBackground.hex)" +
"dir-fg: \(self.directoryForeground.hex)" +
"dir-fg: \(self.directoryForeground.hex)," +
"tab-bg: \(self.tabBackground.hex), tab-fg: \(self.tabForeground.hex)" +
">"
}
@ -76,7 +80,10 @@ struct Theme: CustomStringConvertible {
self.highlightBackground = nvimTheme.visualBackground
self.directoryForeground = nvimTheme.directoryForeground
self.tabBackground = nvimTheme.tabBackground
self.tabForeground = nvimTheme.tabForeground
self.updateCssColors(additionalColorDict)
}

View File

@ -1,6 +1,7 @@
# Next
* Properly include `libintl` such that for example `:languge` works.
* GH-1059: Improved coloring of custom tabs; thanks @s-daveb for the PR!
* Bugfix: Filetype detection issue
* Dependencies updates:
- sparkle-project/Sparkle@2.6.0