Explicitly set color and background attributes for all <span> tags
This commit is contained in:
52
batteries.go
52
batteries.go
@@ -57,17 +57,20 @@ func UpdateBatteryInfo() {
|
||||
case ch > 85:
|
||||
if Conf.Battery.ChargeColor.Full == "" {
|
||||
chStr = fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>% 3d%%</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>",
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.Full,
|
||||
ch,
|
||||
)
|
||||
} else {
|
||||
chStr = fmt.Sprintf(
|
||||
`<span font='%s' size='%s' foreground='%s'>% 3d%%</span>`,
|
||||
`<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>`,
|
||||
Conf.Battery.ChargeColor.Full,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.Full,
|
||||
ch,
|
||||
)
|
||||
}
|
||||
@@ -75,17 +78,20 @@ func UpdateBatteryInfo() {
|
||||
case ch < 85 && ch > 40:
|
||||
if Conf.Battery.ChargeColor.AlmostFull == "" {
|
||||
chStr = fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>% 3d%%</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>",
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.Full,
|
||||
ch,
|
||||
)
|
||||
} else {
|
||||
chStr = fmt.Sprintf(
|
||||
`<span font='%s' size='%s' foreground='%s'>% 3d%%</span>`,
|
||||
`<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>`,
|
||||
Conf.Battery.ChargeColor.AlmostFull,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.AlmostFull,
|
||||
ch,
|
||||
)
|
||||
}
|
||||
@@ -93,17 +99,20 @@ func UpdateBatteryInfo() {
|
||||
case ch <= 40 && ch >= 10:
|
||||
if Conf.Battery.ChargeColor.AlmostEmpty == "" {
|
||||
chStr = fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>% 3d%%</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>",
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.Full,
|
||||
ch,
|
||||
)
|
||||
} else {
|
||||
chStr = fmt.Sprintf(
|
||||
`<span font='%s' size='%s' foreground='%s'>% 3d%%</span>`,
|
||||
`<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>`,
|
||||
Conf.Battery.ChargeColor.AlmostEmpty,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.AlmostEmpty,
|
||||
ch,
|
||||
)
|
||||
}
|
||||
@@ -111,31 +120,40 @@ func UpdateBatteryInfo() {
|
||||
case ch < 10:
|
||||
if Conf.Battery.ChargeColor.Empty == "" {
|
||||
chStr = fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>% 3d%%</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>",
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.Full,
|
||||
ch,
|
||||
)
|
||||
} else {
|
||||
chStr = fmt.Sprintf(
|
||||
`<span font='%s' size='%s' foreground='%s'>% 3d%%</span>`,
|
||||
`<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>`,
|
||||
Conf.Battery.ChargeColor.Empty,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.Empty,
|
||||
ch,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
battsInfo += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>%s</span><span font='%s' size='%s'>B%d </span>%s<span font='%s' size='%s'> %s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span><span color='%s' background='%s' font='%s' size='%s'>B%d </span>%s<span color='%s' background='%s' font='%s' size='%s'> %s</span>",
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.SymbolFont,
|
||||
Conf.Battery.SymbolFontSize,
|
||||
Conf.Battery.Symbol,
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
i,
|
||||
chStr,
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
status,
|
||||
|
||||
28
main.go
28
main.go
@@ -198,7 +198,9 @@ func main() {
|
||||
}
|
||||
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>CPU: %d°</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>CPU: %d°</span>",
|
||||
Conf.CPUTemp.Color,
|
||||
Conf.CPUTemp.Background,
|
||||
Conf.CPUTemp.Font,
|
||||
Conf.CPUTemp.FontSize,
|
||||
CPUTemperature,
|
||||
@@ -238,7 +240,9 @@ func main() {
|
||||
|
||||
if Conf.Mem.ShowSwap {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>M:%d%% SHM:%dM SW:%dM</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>M:%d%% SHM:%dM SW:%dM</span>",
|
||||
Conf.Mem.Color,
|
||||
Conf.Mem.Background,
|
||||
Conf.Mem.Font,
|
||||
Conf.Mem.FontSize,
|
||||
Memory.Usedpct,
|
||||
@@ -247,7 +251,9 @@ func main() {
|
||||
)
|
||||
} else {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>M:%d%% SHM:%dM</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>M:%d%% SHM:%dM</span>",
|
||||
Conf.Mem.Color,
|
||||
Conf.Mem.Background,
|
||||
Conf.Mem.Font,
|
||||
Conf.Mem.FontSize,
|
||||
Memory.Usedpct,
|
||||
@@ -288,7 +294,9 @@ func main() {
|
||||
}
|
||||
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>LA:%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>LA:%s</span>",
|
||||
Conf.LA.Color,
|
||||
Conf.LA.Background,
|
||||
Conf.LA.Font,
|
||||
Conf.LA.FontSize,
|
||||
La,
|
||||
@@ -327,7 +335,9 @@ func main() {
|
||||
}
|
||||
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size= '%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size= '%s'>%s</span>",
|
||||
Conf.NetIf.Color,
|
||||
Conf.NetIf.Background,
|
||||
Conf.NetIf.Font,
|
||||
Conf.NetIf.FontSize,
|
||||
IfStatus,
|
||||
@@ -366,7 +376,9 @@ func main() {
|
||||
}
|
||||
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Vpn.Color,
|
||||
Conf.Vpn.Background,
|
||||
Conf.Vpn.Font,
|
||||
Conf.Vpn.FontSize,
|
||||
VPNStatus,
|
||||
@@ -476,7 +488,9 @@ func main() {
|
||||
}
|
||||
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Clock.Color,
|
||||
Conf.Clock.Background,
|
||||
Conf.Clock.Font,
|
||||
Conf.Clock.FontSize,
|
||||
Clock,
|
||||
|
||||
@@ -68,10 +68,18 @@ func UpdateVolumeInfo() {
|
||||
}
|
||||
|
||||
SoundVolume = fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>%s</span><span font='%s' size='%s'>:%d%%</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.SimpleVolumePa.Color,
|
||||
Conf.SimpleVolumePa.Background,
|
||||
Conf.SimpleVolumePa.SymbolFont,
|
||||
Conf.SimpleVolumePa.SymbolFontSize,
|
||||
Conf.SimpleVolumePa.Symbol,
|
||||
)
|
||||
|
||||
SoundVolume += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>:%d%%</span>",
|
||||
Conf.SimpleVolumePa.Color,
|
||||
Conf.SimpleVolumePa.Background,
|
||||
Conf.SimpleVolumePa.Font,
|
||||
Conf.SimpleVolumePa.FontSize,
|
||||
int64(vol*100),
|
||||
|
||||
Reference in New Issue
Block a user