From c421dd0fe7b29f7bc9bd51bbadba923533e6b1ba Mon Sep 17 00:00:00 2001 From: Greg Date: Thu, 11 Sep 2025 08:40:16 +0200 Subject: [PATCH] updated colors --- config.go | 26 ++++++++++++++++++++------ config.yml | 15 +++++++++++++++ flexradio.go | 45 +++++++++++++++++++++++++++++++++++---------- 3 files changed, 70 insertions(+), 16 deletions(-) diff --git a/config.go b/config.go index 7b1d88c..12d45c6 100644 --- a/config.go +++ b/config.go @@ -12,12 +12,26 @@ var Cfg *Config type Config struct { General struct { - DeleteLogFileAtStart bool `yaml:"delete_log_file_at_start"` - LogToFile bool `yaml:"log_to_file"` - Callsign string `yaml:"callsign"` - LogLevel string `yaml:"log_level"` - TelnetServer bool `yaml:"telnetserver"` - FlexRadioSpot bool `yaml:"flexradiospot"` + DeleteLogFileAtStart bool `yaml:"delete_log_file_at_start"` + LogToFile bool `yaml:"log_to_file"` + Callsign string `yaml:"callsign"` + LogLevel string `yaml:"log_level"` + TelnetServer bool `yaml:"telnetserver"` + FlexRadioSpot bool `yaml:"flexradiospot"` + SpotColorNewEntity string `yaml:"spot_color_new_entity"` + BackgroundColorNewEntity string `yaml:"background_color_new_entity"` + SpotColorNewBand string `yaml:"spot_color_new_band"` + BackgroundColorNewBand string `yaml:"background_color_new_band"` + SpotColorNewMode string `yaml:"spot_color_new_mode"` + BackgroundColorNewMode string `yaml:"background_color_new_mode"` + SpotColorNewBandMode string `yaml:"spot_color_new_band_mode"` + BackgroundColorNewBandMode string `yaml:"background_color_new_band_mode"` + SpotColorNewSlot string `yaml:"spot_color_new_slot"` + BackgroundColorNewSlot string `yaml:"background_color_new_slot"` + SpotColorMyCallsign string `yaml:"spot_color_my_callsign"` + BackgroundColorMyCallsign string `yaml:"background_color_my_callsign"` + SpotColorWorked string `yaml:"spot_color_worked"` + BackgroundColorWorked string `yaml:"background_color_worked"` } `yaml:"general"` Database struct { diff --git a/config.yml b/config.yml index 63c0c35..8cd5fe1 100644 --- a/config.yml +++ b/config.yml @@ -5,6 +5,21 @@ general: log_level: DEBUG # INFO or DEBUG or WARN telnetserver: true # not in use for now flexradiospot: true # not in use for now + # Spot colors, if empty then default, colors in HEX AARRGGBB format + spot_color_new_entity: + background_color_new_entity: + spot_color_new_band: + background_color_new_band: + spot_color_new_mode: + background_color_new_mode: + spot_color_new_band_mode: + background_color_new_band_mode: + spot_color_new_slot: + background_color_new_slot: + spot_color_my_callsign: + background_color_my_callsign: + spot_color_worked: + background_color_worked: database: mysql: false #only one of the two can be true sqlite: true diff --git a/flexradio.go b/flexradio.go index 7dd75d1..90c6c40 100644 --- a/flexradio.go +++ b/flexradio.go @@ -175,29 +175,54 @@ func (fc *FlexClient) SendSpottoFlex(spot TelnetSpot) { // If new DXCC if spot.NewDXCC { - flexSpot.Color = "#ff3bf908" flexSpot.Priority = "1" - flexSpot.BackgroundColor = "#ff000000" flexSpot.Comment = flexSpot.Comment + " [New DXCC]" + if Cfg.General.SpotColorNewEntity != "" && Cfg.General.BackgroundColorNewEntity != "" { + flexSpot.Color = Cfg.General.SpotColorNewEntity + flexSpot.BackgroundColor = Cfg.General.BackgroundColorNewEntity + } else { + flexSpot.Color = "#ff3bf908" + flexSpot.BackgroundColor = "#ff000000" + } } else if spot.DX == Cfg.General.Callsign { - flexSpot.Color = "#ffff0000" flexSpot.Priority = "1" - flexSpot.BackgroundColor = "#ff000000" + if Cfg.General.SpotColorMyCallsign != "" && Cfg.General.BackgroundColorMyCallsign != "" { + flexSpot.Color = Cfg.General.SpotColorMyCallsign + flexSpot.BackgroundColor = Cfg.General.BackgroundColorMyCallsign + } else { + flexSpot.Color = "#ffff0000" + flexSpot.BackgroundColor = "#ff000000" + } } else if spot.CallsignWorked { - flexSpot.Color = "#ffeaeaea" - flexSpot.BackgroundColor = "#ff00c0c0" flexSpot.Priority = "5" flexSpot.Comment = flexSpot.Comment + " [Worked]" + if Cfg.General.SpotColorWorked != "" && Cfg.General.BackgroundColorWorked != "" { + flexSpot.Color = Cfg.General.SpotColorWorked + flexSpot.BackgroundColor = Cfg.General.BackgroundColorWorked + } else { + flexSpot.Color = "#ff000000" //#ffeaeaea + flexSpot.BackgroundColor = "#ff00c0c0" + } } else if spot.NewMode && spot.NewBand { - flexSpot.Color = "#ffc603fc" flexSpot.Priority = "1" - flexSpot.BackgroundColor = "#ff000000" flexSpot.Comment = flexSpot.Comment + " [New Band & Mode]" + if Cfg.General.SpotColorNewBandMode != "" && Cfg.General.BackgroundColorNewBandMode != "" { + flexSpot.Color = Cfg.General.SpotColorNewBandMode + flexSpot.BackgroundColor = Cfg.General.BackgroundColorNewBandMode + } else { + flexSpot.Color = "#ffc603fc" + flexSpot.BackgroundColor = "#ff000000" + } } else if spot.NewMode && !spot.NewBand { - flexSpot.Color = "#fff9a908" flexSpot.Priority = "2" - flexSpot.BackgroundColor = "#ff000000" flexSpot.Comment = flexSpot.Comment + " [New Mode]" + if Cfg.General.SpotColorNewMode != "" && Cfg.General.BackgroundColorNewMode != "" { + flexSpot.Color = Cfg.General.SpotColorNewMode + flexSpot.BackgroundColor = Cfg.General.BackgroundColorNewMode + } else { + flexSpot.Color = "#fff9a908" + flexSpot.BackgroundColor = "#ff000000" + } } else if spot.NewBand && !spot.NewMode { flexSpot.Color = "#fff9f508" flexSpot.Priority = "3"