@@ -94,7 +94,7 @@ bool screen_putch_disable_escape_codes = false;
9494
9595void BASIC_INT screen_putch (uint8_t c, bool lazy) {
9696 static bool escape = false ;
97- static uint8_t col_digit = 0 , color, is_bg ;
97+ static uint8_t hex_digit = 0 , hex_value, hex_type ;
9898 static bool reverse = false ;
9999
100100 if (screen_putch_disable_escape_codes) {
@@ -109,18 +109,20 @@ void BASIC_INT screen_putch(uint8_t c, bool lazy) {
109109 }
110110 sc0.putch (' \\ ' );
111111 } else {
112- if (col_digit > 0 ) {
113- if (col_digit == 1 ) {
114- color = hex2value (c);
115- col_digit ++;
112+ if (hex_digit > 0 ) {
113+ if (hex_digit == 1 ) {
114+ hex_value = hex2value (c);
115+ hex_digit ++;
116116 } else {
117- color = (color << 4 ) | hex2value (c);
118- if (is_bg)
119- sc0.setColor (sc0.getFgColor (), color);
117+ hex_value = (hex_value << 4 ) | hex2value (c);
118+ if (hex_type == 0 )
119+ sc0.setColor (sc0.getFgColor (), hex_value);
120+ else if (hex_type == 1 )
121+ sc0.setColor (hex_value, sc0.getBgColor ());
120122 else
121- sc0.setColor (color, sc0. getBgColor () );
123+ sc0.putch (hex_value, lazy );
122124
123- col_digit = 0 ;
125+ hex_digit = 0 ;
124126 }
125127 } else if (escape) {
126128 switch (c) {
@@ -159,12 +161,16 @@ void BASIC_INT screen_putch(uint8_t c, bool lazy) {
159161 case ' c' : sc0.cls (); // fallthrough
160162 case ' h' : sc0.locate (0 , 0 ); break ;
161163 case ' f' :
162- col_digit = 1 ;
163- is_bg = false ;
164+ hex_digit = 1 ;
165+ hex_type = 1 ;
164166 break ;
165167 case ' b' :
166- col_digit = 1 ;
167- is_bg = true ;
168+ hex_digit = 1 ;
169+ hex_type = 0 ;
170+ break ;
171+ case ' x' :
172+ hex_digit = 1 ;
173+ hex_type = 2 ;
168174 break ;
169175 default : break ;
170176 }
0 commit comments