2016-03-21 14:20:39 +11:00
|
|
|
/*
|
2018-08-04 15:14:06 +10:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2016-03-21 14:20:39 +11:00
|
|
|
*
|
|
|
|
* Copyright 2016 Danny Robson <danny@nerdcruft.net>
|
|
|
|
*/
|
|
|
|
|
2021-04-14 15:35:49 +10:00
|
|
|
#pragma once
|
2016-03-21 14:20:39 +11:00
|
|
|
|
2018-03-22 16:10:06 +11:00
|
|
|
#include <iosfwd>
|
2016-03-21 14:20:39 +11:00
|
|
|
|
2018-08-05 14:42:02 +10:00
|
|
|
namespace cruft::term {
|
2016-03-21 14:20:39 +11:00
|
|
|
bool has_csi_support (void);
|
|
|
|
|
|
|
|
namespace csi {
|
|
|
|
struct code {
|
|
|
|
static constexpr char CSI = '\x1B';
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct graphics : public code {
|
|
|
|
static constexpr char terminator = 'm';
|
|
|
|
|
2016-05-12 17:39:33 +10:00
|
|
|
enum layer : char {
|
2016-03-21 14:20:39 +11:00
|
|
|
FOREGROUND = 30,
|
|
|
|
BACKGROUND = 40
|
|
|
|
};
|
|
|
|
|
2016-05-12 17:39:33 +10:00
|
|
|
enum hue : char {
|
2016-03-21 14:20:39 +11:00
|
|
|
BLACK = 0,
|
|
|
|
RED = 1,
|
|
|
|
GREEN = 2,
|
|
|
|
YELLOW = 3,
|
|
|
|
BLUE = 4,
|
|
|
|
MAGENTA = 5,
|
|
|
|
CYAN = 6,
|
|
|
|
WHITE = 7,
|
|
|
|
};
|
|
|
|
|
|
|
|
graphics (layer, hue);
|
|
|
|
explicit graphics (char value);
|
|
|
|
|
|
|
|
char value (void) const;
|
|
|
|
char value (char);
|
|
|
|
|
|
|
|
static const graphics RESET;
|
|
|
|
|
|
|
|
private:
|
|
|
|
char m_value;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
std::ostream& operator<< (std::ostream&, code);
|
|
|
|
std::ostream& operator<< (std::ostream&, graphics);
|
|
|
|
}
|
2021-04-14 15:35:49 +10:00
|
|
|
}
|