コード例 #1
0
ファイル: doscolor.go プロジェクト: anschelsc/doscolor
// 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
}
コード例 #2
0
ファイル: doscolor.go プロジェクト: anschelsc/doscolor
// 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
}