func (color *Color) writeModel(w io.Writer) (err error) {
	model := make([]uint8, 4)
	for i, _ := range model {
		colorModel := color.Model
		if len(color.Model) < 4 {
			for len(colorModel) < 4 {
				colorModel += " "
			}
		}
		model[i] = uint8([]rune(colorModel)[i])
	}
	return binary.Write(w, binary.BigEndian, model)
}
Encode the color's model as a of slice of uint8.
package ase
import (
	"bytes"
	"encoding/binary"
	"errors"
	"io"
	"strings"
	"unicode/utf16"
)
var (
	ErrInvalidColorType  = errors.New("ase: invalid color type")
	ErrInvalidColorValue = errors.New("ase: invalid color value")
	ErrInvalidColorModel = errors.New("ase: invalid color model")
)
type Color struct {
	nameLen uint16
	Name    string
	Model   string  
	Values  []float32
	Type    string  
}
func (color *Color) read(r io.Reader) (err error) {
	if err = color.readNameLen(r); err != nil {
		return
	}
	if err = color.readName(r); err != nil {
		return
	}
	if err = color.readModel(r); err != nil {
		return
	}
	if err = color.readValues(r); err != nil {
		return
	}
	if err = color.readType(r); err != nil {
		return
	}
	return
}
func (color *Color) readNameLen(r io.Reader) error {
	return binary.Read(r, binary.BigEndian, &color.nameLen)
}
func (color *Color) readName(r io.Reader) (err error) {
	if color.nameLen == 0 {
		return
	}
	name := make([]uint16, color.nameLen)  
	if err = binary.Read(r, binary.BigEndian, &name); err != nil {
		return
	}
	color.Name = string(utf16.Decode(name[:len(name)-1]))
	return
}
func (color *Color) readModel(r io.Reader) (err error) {
	colorModel := make([]uint8, 4)
	if err = binary.Read(r, binary.BigEndian, colorModel); err != nil {
		return
	}
	color.Model = strings.TrimSpace(string(colorModel[0:]))
	return
}
func (color *Color) readValues(r io.Reader) (err error) {
	switch color.Model {
	case "RGB":
		rgb := make([]float32, 3)
		if err = binary.Read(r, binary.BigEndian, &rgb); err != nil {
			return
		}
		color.Values = rgb
		break
	case "LAB":
		lab := make([]float32, 3)
		if err = binary.Read(r, binary.BigEndian, &lab); err != nil {
			return
		}
		color.Values = lab
		break
	case "CMYK":
		cmyk := make([]float32, 4)
		if err = binary.Read(r, binary.BigEndian, &cmyk); err != nil {
			return
		}
		color.Values = cmyk
		break
	case "Gray":
		gray := make([]float32, 1)
		if err = binary.Read(r, binary.BigEndian, &gray); err != nil {
			return
		}
		color.Values = gray
		break
	default:
		return ErrInvalidColorValue
	}
	return
}
func (color *Color) readType(r io.Reader) (err error) {
	colorType := make([]int16, 1)
	if err = binary.Read(r, binary.BigEndian, colorType); err != nil {
		return
	}
	switch colorType[0] {
	case 0:
		color.Type = "Global"
		break
	case 1:
		color.Type = "Spot"
		break
	case 2:
		color.Type = "Normal"
		break
	default:
		return ErrInvalidColorType
	}
	return
}
func (color *Color) write(w io.Writer) (err error) {
	if err = color.writeBlockType(w); err != nil {
		return
	}
	if err = color.writeBlockLength(w); err != nil {
		return
	}
	if err = color.writeNameLen(w); err != nil {
		return
	}
	if err = color.writeName(w); err != nil {
		return
	}
	if err = color.writeModel(w); err != nil {
		return
	}
	if err = color.writeValues(w); err != nil {
		return
	}
	if err = color.writeType(w); err != nil {
		return
	}
	return
}
func (color *Color) writeBlockLength(w io.Writer) (err error) {
	blockLength, err := color.calculateBlockLength()
	if err != nil {
		return
	}
	if err = binary.Write(w, binary.BigEndian, blockLength); err != nil {
		return
	}
	return
}
func (color *Color) calculateBlockLength() (blockLength int32, err error) {
	buf := new(bytes.Buffer)
	if err = color.writeNameLen(buf); err != nil {
		return
	}
	if err = color.writeName(buf); err != nil {
		return
	}
	if err = color.writeModel(buf); err != nil {
		return
	}
	if err = color.writeValues(buf); err != nil {
		return
	}
	if err = color.writeType(buf); err != nil {
		return
	}
	blockLength = int32(buf.Len())
	return
}
func (color *Color) writeNameLen(w io.Writer) (err error) {
	return binary.Write(w, binary.BigEndian, color.NameLen()+1)
}
func (color *Color) writeName(w io.Writer) (err error) {
	name := utf16.Encode([]rune(color.Name))
	name = append(name, uint16(0))
	return binary.Write(w, binary.BigEndian, name)
}