package main import ( "bufio" "fmt" "log" "strings" ) func main() { in := `$base03: #002b36; $base02: #073642; $base01: #586e75; $base00: #657b83; $base0: #839496; $base1: #93a1a1; $base2: #eee8d5; $base3: #fdf6e3; $yellow: #b58900; $orange: #cb4b16; $red: #dc322f; $magenta: #d33682; $violet: #6c71c4; $blue: #268bd2; $cyan: #2aa198; $green: #859900; ` s := bufio.NewScanner(strings.NewReader(in)) fmt.Println("{\"Solarized\", []Color{") for s.Scan() { line := s.Text() split := strings.Split(line, "#") color := split[1][:6] fmt.Printf("Color{Color: color.RGBA{0x%s, 0x%s, 0x%s, 0xff}},\n", color[0:2], color[2:4], color[4:6]) } if err := s.Err(); err != nil { log.Fatalf("error scanning colors: %v", err) } fmt.Println("}},") }