IRC color parsing improved even more for /hueg support and closer line spacing. PP4L
This commit is contained in:
parent
e721ac125c
commit
343344e427
@ -160,13 +160,13 @@ int renderFormattedMessage(String message, int cursorY, int lineHeight, bool hig
|
|||||||
tft.setTextFont(1);
|
tft.setTextFont(1);
|
||||||
} else {
|
} else {
|
||||||
if (highlightNick && !nickHighlighted && message.substring(i).startsWith(nick)) {
|
if (highlightNick && !nickHighlighted && message.substring(i).startsWith(nick)) {
|
||||||
tft.setTextColor(TFT_YELLOW);
|
tft.setTextColor(TFT_YELLOW, bgColor); // Set both foreground and background color
|
||||||
for (char nc : nick) {
|
for (char nc : nick) {
|
||||||
tft.print(nc);
|
tft.print(nc);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
i--; // Adjust for the loop increment
|
i--; // Adjust for the loop increment
|
||||||
tft.setTextColor(TFT_WHITE);
|
tft.setTextColor(TFT_WHITE, bgColor); // Reset to white foreground with current background
|
||||||
nickHighlighted = true;
|
nickHighlighted = true;
|
||||||
} else {
|
} else {
|
||||||
if (tft.getCursorX() + tft.textWidth(String(c)) > SCREEN_WIDTH) {
|
if (tft.getCursorX() + tft.textWidth(String(c)) > SCREEN_WIDTH) {
|
||||||
@ -180,6 +180,7 @@ int renderFormattedMessage(String message, int cursorY, int lineHeight, bool hig
|
|||||||
tft.setCursor(tft.getCursorX() + spaceWidth, tft.getCursorY());
|
tft.setCursor(tft.getCursorX() + spaceWidth, tft.getCursorY());
|
||||||
} else {
|
} else {
|
||||||
// Ensure that background color is applied to characters
|
// Ensure that background color is applied to characters
|
||||||
|
tft.fillRect(tft.getCursorX(), tft.getCursorY(), tft.textWidth(String(c)), lineHeight, bgColor);
|
||||||
tft.setTextColor(fgColor, bgColor);
|
tft.setTextColor(fgColor, bgColor);
|
||||||
tft.print(c);
|
tft.print(c);
|
||||||
}
|
}
|
||||||
@ -204,7 +205,6 @@ int renderFormattedMessage(String message, int cursorY, int lineHeight, bool hig
|
|||||||
return cursorY; // Return the new cursor Y position for the next line
|
return cursorY; // Return the new cursor Y position for the next line
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void turnOffScreen() {
|
void turnOffScreen() {
|
||||||
Serial.println("Screen turned off");
|
Serial.println("Screen turned off");
|
||||||
tft.writecommand(TFT_DISPOFF); // Turn off display
|
tft.writecommand(TFT_DISPOFF); // Turn off display
|
||||||
|
Loading…
Reference in New Issue
Block a user