diff kitten: Automatically change colors on terminal color scheme change

This commit is contained in:
Kovid Goyal
2025-01-05 06:00:24 +05:30
parent 98c1e0f7aa
commit f3db7e7554
9 changed files with 113 additions and 35 deletions

View File

@@ -118,6 +118,9 @@ type Loop struct {
// Called when capabilities response is received
OnCapabilitiesReceived func(TerminalCapabilities) error
// Called when the terminal's color scheme changes
OnColorSchemeChange func(ColorPreference) error
}
func New(options ...func(self *Loop)) (*Loop, error) {
@@ -203,6 +206,15 @@ func NoRestoreColors(self *Loop) {
self.terminal_options.restore_colors = false
}
func (self *Loop) ColorSchemeChangeNotifications() *Loop {
self.terminal_options.color_scheme_change_notification = true
return self
}
func ColorSchemeChangeNotifications(self *Loop) {
self.terminal_options.color_scheme_change_notification = true
}
func NoInBandResizeNotifications(self *Loop) {
self.terminal_options.in_band_resize_notification = false
}