This commit is contained in:
Louis Dalibard 2025-01-19 00:26:53 +01:00
parent 5aa06e90fc
commit 853354a11f

View File

@ -44,18 +44,9 @@ type ConfigS struct {
PeriodCropLoopOverCount uint32 PeriodCropLoopOverCount uint32
FFTBufferOffset uint32 FFTBufferOffset uint32
ForceColors bool ForceColors bool
AccentColorR uint8 AccentColor string
AccentColorG uint8 FirstColor string
AccentColorB uint8 ThirdColor string
FirstColorR uint8
FirstColorG uint8
FirstColorB uint8
ThirdColorR uint8
ThirdColorG uint8
ThirdColorB uint8
ThirdColorAdjR uint8
ThirdColorAdjG uint8
ThirdColorAdjB uint8
} }
var DefaultConfig = ConfigS{ var DefaultConfig = ConfigS{
@ -89,15 +80,9 @@ var DefaultConfig = ConfigS{
PeriodCropLoopOverCount: 1, PeriodCropLoopOverCount: 1,
FFTBufferOffset: 3200, FFTBufferOffset: 3200,
ForceColors: false, ForceColors: false,
AccentColorR: 255, AccentColor: "FF0000",
AccentColorG: 0, FirstColor: "FF0000",
AccentColorB: 0, ThirdColor: "FF0000",
FirstColorR: 255,
FirstColorG: 120,
FirstColorB: 120,
ThirdColorR: 255,
ThirdColorG: 0,
ThirdColorB: 0,
} }
var Config ConfigS var Config ConfigS
@ -178,10 +163,17 @@ func updatePywalColors() {
walPath := configdir.LocalCache("wal") walPath := configdir.LocalCache("wal")
walFile := filepath.Join(walPath, "colors") walFile := filepath.Join(walPath, "colors")
if _, err := os.Stat(walFile); os.IsNotExist(err) || Config.ForceColors { if _, err := os.Stat(walFile); os.IsNotExist(err) || Config.ForceColors {
AccentColor = color.RGBA{Config.AccentColorR, Config.AccentColorG, Config.AccentColorB, Config.LineOpacity} AccentColorParsed, err := ParseHexColor(Config.AccentColor)
FirstColor = color.RGBA{Config.FirstColorR, Config.FirstColorG, Config.FirstColorB, Config.LineOpacity} utils.CheckError(err)
ThirdColor = color.RGBA{Config.ThirdColorR, Config.ThirdColorG, Config.ThirdColorB, Config.LineOpacity} FirstColorParsed, err := ParseHexColor(Config.FirstColor)
ThirdColorAdj = color.RGBA{uint8(float64(Config.ThirdColorR) * Config.LineBrightness), uint8(float64(Config.ThirdColorG) * Config.LineBrightness), uint8(float64(Config.ThirdColorB) * Config.LineBrightness), Config.LineOpacity} utils.CheckError(err)
ThirdColorParsed, err := ParseHexColor(Config.ThirdColor)
utils.CheckError(err)
AccentColor = color.RGBA{AccentColorParsed.R, AccentColorParsed.G, AccentColorParsed.B, Config.LineOpacity}
FirstColor = color.RGBA{FirstColorParsed.R, FirstColorParsed.G, FirstColorParsed.B, Config.LineOpacity}
ThirdColor = color.RGBA{ThirdColorParsed.R, ThirdColorParsed.G, ThirdColorParsed.B, Config.LineOpacity}
ThirdColorAdj = color.RGBA{uint8(float64(ThirdColorParsed.R) * Config.LineBrightness), uint8(float64(ThirdColorParsed.G) * Config.LineBrightness), uint8(float64(ThirdColorParsed.B) * Config.LineBrightness), Config.LineOpacity}
} else { } else {
fh, err := os.Open(walFile) fh, err := os.Open(walFile)
utils.CheckError(err) utils.CheckError(err)