-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
EscapeCodes.h
77 lines (60 loc) · 1.96 KB
/
EscapeCodes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/////////////////////////////////////////////////////////////////
/*
Library that returns ANSI escape sequences as Strings
inspiried by Bruce Robertson's ANSITerm
- https://forum.arduino.cc/t/ansiterm-a-ansi-terminal-library/37536/1
- https://github.com/rklancer/ansiterm
- https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797
*/
/////////////////////////////////////////////////////////////////
#include <Arduino.h>
/////////////////////////////////////////////////////////////////
#pragma once
#ifndef EscapeCodes_h
#define EscapeCodes_h
/////////////////////////////////////////////////////////////////
#define ANSI_BLACK 0
#define ANSI_RED 1
#define ANSI_GREEN 2
#define ANSI_YELLOW 3
#define ANSI_BLUE 4
#define ANSI_MAGENTA 5
#define ANSI_CYAN 6
#define ANSI_WHITE 7
#define ANSI_GREY 60
#define ANSI_BRIGHT_RED 61
#define ANSI_BRIGHT_GREEN 62
#define ANSI_BRIGHT_YELLOW 63
#define ANSI_BRIGHT_BLUE 64
#define ANSI_BRIGHT_MAGENTA 65
#define ANSI_BRIGHT_CYAN 66
#define ANSI_BRIGHT_WHITE 67
/////////////////////////////////////////////////////////////////
class EscapeCodes {
public:
static String home();
static String cls();
static String clearLine();
static String clearEoLine();
static String cursorXY(int x, int y);
static String cursorUp(int x);
static String cursorDown(int x);
static String cursorLeft(int x);
static String cursorRight(int x);
static String setBG(int color);
static String setFG(int color);
static String bold(String str);
static String italic(String str);
static String underline(String str);
static String blink(String str);
static String inverse(String str);
static String showCursor(bool blink);
static String reset();
protected:
static String prefix();
static String prefixAndNumberAndValue(int x, char v);
static String setAttribute(int a);
};
/////////////////////////////////////////////////////////////////
#endif
/////////////////////////////////////////////////////////////////