From 01bc6702a956d735917c200de7553e034018d7b0 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Tue, 19 May 2026 14:40:16 +0300 Subject: [PATCH] Color message bar messages --- config/config.yml | 1 + src/config.go | 1 + src/message_bar.go | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/config/config.yml b/config/config.yml index c6c4b44..9691cc9 100644 --- a/config/config.yml +++ b/config/config.yml @@ -6,5 +6,6 @@ selected_style_fallback: "default-fallback" # Style for 8-color capable terminal show_top_menu: true show_line_index: true extend_line_index: false # Extend line index to the bottom of the screen +color_message_bar: true # Add color to message bar messages buffer_info_message: "File: %f, Filetype: %t, Cursor: (%x, %y, %p), Chars: %c" tab_indentation: 4 # Length of tab characters diff --git a/src/config.go b/src/config.go index 0ac8fef..505428c 100644 --- a/src/config.go +++ b/src/config.go @@ -12,6 +12,7 @@ type TyperConfig struct { FallbackStyle string `yaml:"fallback_style,omitempty"` ShowTopMenu bool `yaml:"show_top_menu,omitempty"` ShowLineIndex bool `yaml:"show_line_index,omitempty"` + ColorMessageBar bool `yaml:"color_message_bar"` ExtendLineIndex bool `yaml:"extend_line_index,omitempty"` BufferInfoMessage string `yaml:"buffer_info_message,omitempty"` TabIndentation int `yaml:"tab_indentation,omitempty"` diff --git a/src/message_bar.go b/src/message_bar.go index 5b46edb..3191ed2 100644 --- a/src/message_bar.go +++ b/src/message_bar.go @@ -82,10 +82,19 @@ func drawMessageBar(window *Window) { if lastMessage != nil && time.Since(time.UnixMilli(lastMessage.Timestamp)).Seconds() < 5 { switch lastMessage.Urgency { case TYPER_MESSAGE_INFO: + if Config.ColorMessageBar { + messageBarStyle = messageBarStyle.Foreground(CurrentStyle.SyntaxInfo) + } messageToPrint = "[INFO] " case TYPER_MESSAGE_WARNING: + if Config.ColorMessageBar { + messageBarStyle = messageBarStyle.Foreground(CurrentStyle.SyntaxWarning) + } messageToPrint = "[WARNING] " case TYPER_MESSAGE_ERROR: + if Config.ColorMessageBar { + messageBarStyle = messageBarStyle.Foreground(CurrentStyle.SyntaxError) + } messageToPrint = "[ERROR] " default: messageToPrint = "[???] "