diff --git a/NvimView/Sources/NvimView/NvimView+Resize.swift b/NvimView/Sources/NvimView/NvimView+Resize.swift index b90928c95..75898c073 100644 --- a/NvimView/Sources/NvimView/NvimView+Resize.swift +++ b/NvimView/Sources/NvimView/NvimView+Resize.swift @@ -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 diff --git a/NvimView/Sources/NvimView/NvimView+Types.swift b/NvimView/Sources/NvimView/NvimView+Types.swift index 5a12c5b93..298b264bd 100644 --- a/NvimView/Sources/NvimView/NvimView+Types.swift +++ b/NvimView/Sources/NvimView/NvimView+Types.swift @@ -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)" + ">" } } diff --git a/NvimView/Sources/NvimView/NvimView+UiBridge.swift b/NvimView/Sources/NvimView/NvimView+UiBridge.swift index 28b3770d9..19911116a 100644 --- a/NvimView/Sources/NvimView/NvimView+UiBridge.swift +++ b/NvimView/Sources/NvimView/NvimView+UiBridge.swift @@ -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 diff --git a/Tabs/Sources/Tabs/Tab.swift b/Tabs/Sources/Tabs/Tab.swift index 91404c14e..9fbc9e2c8 100644 --- a/Tabs/Sources/Tabs/Tab.swift +++ b/Tabs/Sources/Tabs/Tab.swift @@ -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 diff --git a/Tabs/Sources/Tabs/Theme.swift b/Tabs/Sources/Tabs/Theme.swift index 19383b8be..2fd644423 100644 --- a/Tabs/Sources/Tabs/Theme.swift +++ b/Tabs/Sources/Tabs/Theme.swift @@ -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 ) } } diff --git a/VimR/VimR/MainWindow.swift b/VimR/VimR/MainWindow.swift index 74ff8f561..f72e3c86d 100644 --- a/VimR/VimR/MainWindow.swift +++ b/VimR/VimR/MainWindow.swift @@ -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 diff --git a/VimR/VimR/Theme.swift b/VimR/VimR/Theme.swift index 89e769fe2..6bd3a0817 100644 --- a/VimR/VimR/Theme.swift +++ b/VimR/VimR/Theme.swift @@ -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) }