1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[colors] displaying node_numbers colors for 24bit color

This commit is contained in:
Witold Filipczyk 2022-03-18 16:33:52 +01:00
parent 407ca7d114
commit 9b1b2f4590
3 changed files with 42 additions and 2 deletions

View File

@ -28,6 +28,7 @@ struct bfu_color_entry {
unsigned int node_number; unsigned int node_number;
unsigned int was_color256_set:1; unsigned int was_color256_set:1;
unsigned int was_color24_set:1;
struct screen_char c256; struct screen_char c256;
struct screen_char c24; struct screen_char c24;
@ -63,6 +64,33 @@ get_bfu_foreground_color256_node(unsigned int node_number)
return TERM_COLOR_FOREGROUND_256(entry->c256.c.color); return TERM_COLOR_FOREGROUND_256(entry->c256.c.color);
} }
unsigned char *
get_bfu_background_color_true_node(unsigned int node_number)
{
struct bfu_color_entry *entry = node_entries[node_number];
if (!entry->was_color24_set) {
set_term_color(&entry->c24, &entry->colors, 0, COLOR_MODE_TRUE_COLOR);
entry->was_color24_set = 1;
}
return &entry->c24.c.color[3];
}
unsigned char *
get_bfu_foreground_color_true_node(unsigned int node_number)
{
struct bfu_color_entry *entry = node_entries[node_number];
if (!entry->was_color24_set) {
set_term_color(&entry->c24, &entry->colors, 0, COLOR_MODE_TRUE_COLOR);
entry->was_color24_set = 1;
}
return &entry->c24.c.color[0];
}
static struct bfu_color_entry * static struct bfu_color_entry *
get_bfu_color_common(struct terminal *term, const char *stylename) get_bfu_color_common(struct terminal *term, const char *stylename)
{ {

View File

@ -29,6 +29,8 @@ unsigned int get_bfu_color_node(struct terminal *term, const char *stylename);
unsigned char get_bfu_background_color256_node(unsigned int node_number); unsigned char get_bfu_background_color256_node(unsigned int node_number);
unsigned char get_bfu_foreground_color256_node(unsigned int node_number); unsigned char get_bfu_foreground_color256_node(unsigned int node_number);
unsigned char *get_bfu_background_color_true_node(unsigned int node_number);
unsigned char *get_bfu_foreground_color_true_node(unsigned int node_number);
/** Cleanup after the BFU style cache /** Cleanup after the BFU style cache
* *

View File

@ -1233,14 +1233,24 @@ static const struct string color_true_seqs[] = {
static unsigned char * static unsigned char *
get_true_background_color_from_node(struct screen_char *ch) get_true_background_color_from_node(struct screen_char *ch)
{ {
/* TODO */ unsigned int node_number = ch->c.node_number;
if (node_number < 1024) {
return get_bfu_background_color_true_node(node_number);
}
return &(ch)->c.color[3]; return &(ch)->c.color[3];
} }
static unsigned char * static unsigned char *
get_true_foreground_color_from_node(struct screen_char *ch) get_true_foreground_color_from_node(struct screen_char *ch)
{ {
/* TODO */ unsigned int node_number = ch->c.node_number;
if (node_number < 1024) {
return get_bfu_foreground_color_true_node(node_number);
}
return &(ch)->c.color[0]; return &(ch)->c.color[0];
} }