set colors

This commit is contained in:
shoopea
2021-12-11 11:50:24 +08:00
parent bd6a5422cb
commit f21a8e5736
5 changed files with 980 additions and 927 deletions

View File

@@ -3,6 +3,7 @@ package main
import (
_ "embed"
"encoding/json"
"image/color"
"io/ioutil"
"time"
@@ -128,3 +129,46 @@ func (c *Config) GetCompanyClient(id uint8) *ClientConfig {
}
return nil
}
func (c *Config) GetClientColor(id int) color.Color {
cc, ok := c.Clients[id]
if !ok {
return color.RGBA{0, 0, 0, 255} // Black
}
switch cc.Color {
case "Dark Blue":
return color.RGBA{28, 68, 140, 255}
case "Pale Green":
return color.RGBA{76, 116, 88, 255}
case "Pink":
return color.RGBA{188, 84, 108, 255}
case "Yellow":
return color.RGBA{212, 156, 32, 255}
case "Red":
return color.RGBA{196, 0, 0, 255}
case "Light Blue":
return color.RGBA{52, 112, 132, 255}
case "Green":
return color.RGBA{84, 132, 20, 255}
case "Dark Green":
return color.RGBA{80, 104, 60, 255}
case "Blue":
return color.RGBA{24, 120, 220, 255}
case "Cream":
return color.RGBA{184, 112, 80, 255}
case "Mauve":
return color.RGBA{80, 80, 116, 255}
case "Purple":
return color.RGBA{104, 76, 196, 255}
case "Orange":
return color.RGBA{252, 156, 0, 255}
case "Brown":
return color.RGBA{124, 104, 72, 255}
case "Gray":
return color.RGBA{116, 116, 116, 255}
case "White":
return color.RGBA{184, 184, 184, 255}
default:
return color.RGBA{0, 0, 0, 255} // Black
}
}