mirror of
https://github.com/qvacua/vimr.git
synced 2024-10-26 17:59:08 +03:00
Merge pull request #1059 from s-daveb/master
Modify theming code: custom tab theme is now pulled from TablineSel highlight group
This commit is contained in:
commit
129173b04e
@ -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
|
||||
|
@ -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)" +
|
||||
">"
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user