diff --git a/style/style.go b/style/style.go index 96b1ecb..5aa2f13 100644 --- a/style/style.go +++ b/style/style.go @@ -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) {