Roll back embedded color565

This commit is contained in:
Edward Firmo
2023-11-07 21:56:25 +01:00
parent c56f482516
commit 6ecf19e935

View File

@@ -1939,12 +1939,20 @@ script:
background: int[]
then:
- lambda: |-
int fg565 = -1;
int bg565 = -1;
// Foreground
if (foreground.size() == 3 and foreground[0] >= 0 and foreground[1] >= 0 and foreground[2] >= 0) disp1->set_component_font_color(component.c_str(), Color(foreground[0], foreground[1], foreground[2]));
else if (foreground.size() == 1 and foreground[0] >= 0) disp1->set_component_font_color(component.c_str(), foreground[0]);
if (foreground.size() == 3 and foreground[0] >= 0 and foreground[1] >= 0 and foreground[2] >= 0) fg565 = ((foreground[0] & 0b11111000) << 8) | ((foreground[1] & 0b11111100) << 3) | (foreground[2] >> 3);
else if (foreground.size() == 1) fg565 = foreground[0];
else fg565 = -1;
if (fg565 >= 0) disp1->set_component_font_color(component.c_str(), fg565);
// Background
if (background.size() == 3 and background[0] >= 0 and background[1] >= 0 and background[2] >= 0) disp1->set_component_background_color(component.c_str(), Color(background[0], background[1], background[2]));
else if (background.size() == 1 and background[0] >= 0) disp1->set_component_background_color(component.c_str(), background[0]);
if (background.size() == 3 and background[0] >= 0 and background[1] >= 0 and background[2] >= 0) bg565 = ((background[0] & 0b11111000) << 8) | ((background[1] & 0b11111100) << 3) | (background[2] >> 3);
else if (background.size() == 1) bg565 = background[0];
else bg565 = -1;
if (bg565 >= 0) disp1->set_component_background_color(component.c_str(), bg565);
- id: display_wrapped_text
mode: queued