func (w *Waveform) setFGColorFunction(function ColorFunc) error {
	if function == nil {
		return errFGColorFunctionNil
	}
	w.fgColorFn = function
	return nil
}
setFGColorFunction directly sets the foreground ColorFunc member of the
receiving Waveform struct.
package waveform
import "fmt"
var (
	errBGColorFunctionNil = &OptionsError{
		Option: "bgColorFunction",
		Reason: "function cannot be nil",
	}
	errFGColorFunctionNil = &OptionsError{
		Option: "fgColorFunction",
		Reason: "function cannot be nil",
	}
	errSampleFunctionNil = &OptionsError{
		Option: "sampleFunction",
		Reason: "function cannot be nil",
	}
	errResolutionZero = &OptionsError{
		Option: "resolution",
		Reason: "resolution cannot be 0",
	}
	errScaleXZero = &OptionsError{
		Option: "scale",
		Reason: "X scale cannot be 0",
	}
	errScaleYZero = &OptionsError{
		Option: "scale",
		Reason: "Y scale cannot be 0",
	}
)
type OptionsError struct {
	Option string
	Reason string
}
func (e *OptionsError) Error() string {
	return fmt.Sprintf("%s: %s", e.Option, e.Reason)
}
type OptionsFunc func(*Waveform) error
func (w *Waveform) SetOptions(options ...OptionsFunc) error {
	for _, o := range options {
		if o == nil {
			continue
		}
		if err := o(w); err != nil {
			return err
		}
	}
	return nil
}
func BGColorFunction(function ColorFunc) OptionsFunc {
	return func(w *Waveform) error {
		return w.setBGColorFunction(function)
	}
}
func (w *Waveform) SetBGColorFunction(function ColorFunc) error {
	return w.SetOptions(BGColorFunction(function))
}
func (w *Waveform) setBGColorFunction(function ColorFunc) error {
	if function == nil {
		return errBGColorFunctionNil
	}
	w.bgColorFn = function
	return nil
}
func FGColorFunction(function ColorFunc) OptionsFunc {
	return func(w *Waveform) error {
		return w.setFGColorFunction(function)
	}
}
func (w *Waveform) SetFGColorFunction(function ColorFunc) error {
	return w.SetOptions(FGColorFunction(function))
}