Ejemplo n.º 1
0
// Save saves the current coloring so that it can be Restored later.
func (w *Wrapper) Save() error {
	w.saved = w32.GetConsoleScreenBufferInfo(w.h)
	if w.saved == nil {
		return syscall.Errno(w32.GetLastError())
	}
	return nil
}
Ejemplo n.º 2
0
// Change the coloring to c, but only in those bits where m is 1.
func (w *Wrapper) SetMask(c Color, m uint16) error {
	current := w32.GetConsoleScreenBufferInfo(w.h)
	if current == nil {
		return syscall.Errno(w32.GetLastError())
	}
	if !w32.SetConsoleTextAttribute(w.h, apply(current.WAttributes, uint16(c), uint16(m))) {
		return syscall.Errno(w32.GetLastError())
	}
	return nil
}