IRC color parsing improved even more for /hueg support and closer line spacing. PP4L

This commit is contained in:
Dionysus 2024-05-26 20:21:17 -04:00
parent e721ac125c
commit 343344e427
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE

View File

@ -160,13 +160,13 @@ int renderFormattedMessage(String message, int cursorY, int lineHeight, bool hig
tft.setTextFont(1);
} else {
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) {
tft.print(nc);
i++;
}
i--; // Adjust for the loop increment
tft.setTextColor(TFT_WHITE);
tft.setTextColor(TFT_WHITE, bgColor); // Reset to white foreground with current background
nickHighlighted = true;
} else {
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());
} else {
// 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.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
}
void turnOffScreen() {
Serial.println("Screen turned off");
tft.writecommand(TFT_DISPOFF); // Turn off display