summaryrefslogtreecommitdiff
path: root/vt100.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-04-10 16:37:39 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-04-10 16:37:39 +0200
commitae2d2dbbe33a98cf41350ef37947c21461479d68 (patch)
tree2dde07d38270a13baf1dcd85af4004bc663e104e /vt100.go
Initial import
Diffstat (limited to 'vt100.go')
-rw-r--r--vt100.go62
1 files changed, 62 insertions, 0 deletions
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
+}