2016-05-02 13:29:21 +08:00
|
|
|
// Generic output functions.
|
|
|
|
//
|
|
|
|
// Constants for various character classifications. Each character of a command string can be
|
|
|
|
// classified as one of the following types.
|
2005-10-04 23:11:39 +08:00
|
|
|
#ifndef FISH_OUTPUT_H
|
|
|
|
#define FISH_OUTPUT_H
|
|
|
|
|
2023-05-29 07:13:54 +08:00
|
|
|
#include <stdint.h>
|
2016-04-21 14:00:54 +08:00
|
|
|
|
2016-05-02 13:29:21 +08:00
|
|
|
#include "color.h"
|
2005-10-04 23:11:39 +08:00
|
|
|
|
2023-05-29 07:13:54 +08:00
|
|
|
#if INCLUDE_RUST_HEADERS
|
|
|
|
#include "output.rs.h"
|
|
|
|
#else
|
|
|
|
// Hacks to allow us to compile without Rust headers.
|
|
|
|
struct outputter_t;
|
|
|
|
#endif
|
2005-09-20 21:26:39 +08:00
|
|
|
|
2023-05-29 07:13:54 +08:00
|
|
|
class env_var_t;
|
2019-11-19 08:54:36 +08:00
|
|
|
rgb_color_t parse_color(const env_var_t &var, bool is_background);
|
2005-09-20 21:26:39 +08:00
|
|
|
|
2016-05-02 13:29:21 +08:00
|
|
|
/// Sets what colors are supported.
|
|
|
|
enum { color_support_term256 = 1 << 0, color_support_term24bit = 1 << 1 };
|
2023-05-29 07:13:54 +08:00
|
|
|
using color_support_t = uint8_t;
|
2023-05-17 03:46:16 +08:00
|
|
|
extern "C" {
|
2023-05-29 07:13:54 +08:00
|
|
|
color_support_t output_get_color_support();
|
|
|
|
void output_set_color_support(color_support_t val);
|
2023-05-17 03:46:16 +08:00
|
|
|
}
|
2012-02-14 01:52:17 +08:00
|
|
|
|
2019-11-19 08:54:36 +08:00
|
|
|
rgb_color_t best_color(const std::vector<rgb_color_t> &candidates, color_support_t support);
|
2014-11-10 08:42:35 +08:00
|
|
|
|
2023-05-29 07:13:54 +08:00
|
|
|
// Temporary to support builtin set_color.
|
|
|
|
void writembs_nofail(outputter_t &outp, const char *str);
|
|
|
|
void writembs(outputter_t &outp, const char *str);
|
2013-02-15 07:50:24 +08:00
|
|
|
|
2005-10-04 23:11:39 +08:00
|
|
|
#endif
|