From ae2d2dbbe33a98cf41350ef37947c21461479d68 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 10 Apr 2015 16:37:39 +0200 Subject: Initial import --- vt100.go | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 vt100.go (limited to 'vt100.go') diff --git a/vt100.go b/vt100.go new file mode 100644 index 0000000..d3037fc --- /dev/null +++ b/vt100.go @@ -0,0 +1,62 @@ +package vt100 + +type ( + Normal string + Bold string + Underline string + Blink string + Inverse string + DoubleWidth string + DoubleHeight string + DoubleHeightTop string + DoubleHeightBottom string +) + +var ( + esc = string(033) + normal = esc + "[0m" + bold = esc + "[1m" + underline = esc + "[4m" + blink = esc + "[5m" + inverse = esc + "[7m" + doubleWidth = esc + "#6" + doubleHeightTop = esc + "#3" + doubleHeightBottom = esc + "#4" +) + +func (s Normal) String() string { + return normal + string(s) + normal +} + +func (s Bold) String() string { + return bold + string(s) + normal +} + +func (s Underline) String() string { + return underline + string(s) + normal +} + +func (s Blink) String() string { + return blink + string(s) + normal +} + +func (s Inverse) String() string { + return inverse + string(s) + normal +} + +func (s DoubleWidth) String() string { + return doubleWidth + string(s) + normal +} + +func (s DoubleHeight) String() string { + return DoubleHeightTop(s).String() + "\n" + + DoubleHeightBottom(s).String() +} + +func (s DoubleHeightTop) String() string { + return doubleHeightTop + string(s) + normal +} + +func (s DoubleHeightBottom) String() string { + return doubleHeightBottom + string(s) + normal +} -- cgit v1.2.3