finally finished this. it should be 1:1 with the original rust version...
ci / unix (macos-15) (push) Canceled after 0s
ci / unix (macos-15-intel) (push) Canceled after 0s
ci / unix (ubuntu-24.04) (push) Canceled after 0s
ci / unix (ubuntu-24.04-arm) (push) Canceled after 0s
ci / windows (push) Canceled after 0s
ci / freebsd (push) Canceled after 0s
release / dist (push) Canceled after 0s
release / build (, macos-arm64, macos-15) (push) Canceled after 0s
release / build (, macos-x86_64, macos-15-intel) (push) Canceled after 0s
release / build (-static, linux-aarch64, ubuntu-24.04-arm) (push) Canceled after 0s
release / build (-static, linux-x86_64, ubuntu-24.04) (push) Canceled after 0s
release / windows (push) Canceled after 0s
release / release (push) Canceled after 0s
ci / unix (macos-15) (push) Canceled after 0s
ci / unix (macos-15-intel) (push) Canceled after 0s
ci / unix (ubuntu-24.04) (push) Canceled after 0s
ci / unix (ubuntu-24.04-arm) (push) Canceled after 0s
ci / windows (push) Canceled after 0s
ci / freebsd (push) Canceled after 0s
release / dist (push) Canceled after 0s
release / build (, macos-arm64, macos-15) (push) Canceled after 0s
release / build (, macos-x86_64, macos-15-intel) (push) Canceled after 0s
release / build (-static, linux-aarch64, ubuntu-24.04-arm) (push) Canceled after 0s
release / build (-static, linux-x86_64, ubuntu-24.04) (push) Canceled after 0s
release / windows (push) Canceled after 0s
release / release (push) Canceled after 0s
This commit is contained in:
1 parent
7aff48a428
commit
b5e3328f64
8 files changed
+337
-162
No files matched your search
@@ -8,6 +8,7 @@
|
||||
#include <locale.h>
|
||||
#include <stdbool.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "helper.h"
|
||||
|
||||
|
||||
+4
-20
@@ -11,24 +11,6 @@ typedef enum color_mode {
|
||||
MODE_TRUECOLOR
|
||||
}color_mode;
|
||||
|
||||
typedef enum NamedColor {
|
||||
Black,
|
||||
Red,
|
||||
Green,
|
||||
Yellow,
|
||||
Blue,
|
||||
Magenta,
|
||||
Cyan,
|
||||
White,
|
||||
BrightBlack,
|
||||
BrightRed,
|
||||
BrightGreen,
|
||||
BrightYellow,
|
||||
BrightBlue,
|
||||
BrightMagenta,
|
||||
BrightCyan,
|
||||
BrightWhite,
|
||||
}NamedColor;
|
||||
|
||||
typedef struct{
|
||||
unsigned char red;
|
||||
@@ -45,6 +27,9 @@ typedef struct colorconfig {
|
||||
int brightness; //default 50
|
||||
rgbcolor *rainbow_cache; //array of rgbcolor malloced
|
||||
size_t rainbow_count;
|
||||
bool has_gradient;
|
||||
rgbcolor gradient_start;
|
||||
rgbcolor gradient_end;
|
||||
}colorconfig;
|
||||
|
||||
typedef enum ColorParseError {
|
||||
@@ -53,13 +38,11 @@ typedef enum ColorParseError {
|
||||
COLOR_ERR_HEX,
|
||||
COLOR_ERR_RGB,
|
||||
COLOR_ERR_HSL,
|
||||
COLOR_ERR_UNKNOWN_NAME
|
||||
}ColorParseError;
|
||||
|
||||
void colorconfig_init(colorconfig *config);
|
||||
enum color_mode detect_color_mode(void);
|
||||
bool enable_windows_ansi(void);
|
||||
int parse_namedcolors(const char *name, rgbcolor *out_rgb);
|
||||
ColorParseError parse_color(const char *s, rgbcolor *out);
|
||||
const char *color_parse_error_message(ColorParseError error);
|
||||
unsigned char rgb_to_ansi16(rgbcolor rgb);
|
||||
@@ -67,5 +50,6 @@ unsigned char rgb_to_ansi256(rgbcolor rgb);
|
||||
rgbcolor hsl_to_rgb(unsigned short h, unsigned char s, unsigned char l);
|
||||
rgbcolor lerp_color_hsv(rgbcolor start, rgbcolor end, float t);
|
||||
void rgb_to_fg_escape(rgbcolor rgb, color_mode mode, char *out, size_t size);
|
||||
void print_color_debug(const colorconfig *config, bool ansi_enabled);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user