amend NewStyleByDef

This commit is contained in:
Mahdi Abu Yasmine 2023-11-05 13:49:27 +01:00
parent bd9a98cdc8
commit 5458ca37ba

View File

@ -50,11 +50,16 @@ func (s *Style) Ln() {
func NewStyleByDef(def string) *Style {
var o []string = []string{}
var c []string = []string{"FFFFFF"}
d := strings.Fields(def)
c := strings.Split(d[KEY_STYLE_COLOR], ",")
if len(d) > KEY_STYLE_OPTION {
o = strings.Split(d[KEY_STYLE_OPTION], ",")
if len(d) > KEY_STYLE_COLOR {
c = strings.Split(d[KEY_STYLE_COLOR], ",")
if len(d) > KEY_STYLE_OPTION {
o = strings.Split(d[KEY_STYLE_OPTION], ",")
}
}
util.PrependToSliceStr(&c, "#")
var s *color.RGBStyle
switch len(c) {