diff --git a/config/loader.go b/config/loader.go index d8af616..f60e62d 100644 --- a/config/loader.go +++ b/config/loader.go @@ -6,11 +6,14 @@ import ( "regexp" "strings" + "gitea.meta-tech.academy/go/core/style" "gopkg.in/yaml.v3" ) type Cfg interface { GetVar() []VarConfig + GetStylesDef() []string + SetStyles(*style.Styles) } type VarConfig struct { @@ -38,7 +41,16 @@ func LoadConfig(path string, out Cfg, varPattern *VarPattern) { cl.Config = out cl.parse() cl.refstr = []*reflect.Value{} - // cl.setConfigPtr(outi) + cl.buildStyles(out) +} + +func (cl *ConfigLoader) buildStyles(out Cfg) { + styles := style.NewStyles() + for _, def := range out.GetStylesDef() { + s := style.NewStyleByDef(def) + styles.List[s.Name] = s + } + out.SetStyles(styles) } func (cl *ConfigLoader) findVarName(match string) string {