Project import generated by Copybara.

GitOrigin-RevId: 0acb173e07e155358594d3ce7b5f19e91bb9fec3
diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
index 559a730..79c9bd8 100644
--- a/drivers/video/console/sticon.c
+++ b/drivers/video/console/sticon.c
@@ -291,13 +291,13 @@ static unsigned long sticon_getxy(struct vc_data *conp, unsigned long pos,
 static u8 sticon_build_attr(struct vc_data *conp, u8 color, u8 intens,
 			    u8 blink, u8 underline, u8 reverse, u8 italic)
 {
-	u8 fg = color & 7;
-	u8 bg = (color & 0x70) >> 4;
+    u8 attr = ((color & 0x70) >> 1) | ((color & 7));
 
-	if (reverse)
-		return (fg << 3) | bg;
-	else
-		return (bg << 3) | fg;
+    if (reverse) {
+	color = ((color >> 3) & 0x7) | ((color & 0x7) << 3);
+    }
+
+    return attr;
 }
 
 static void sticon_invert_region(struct vc_data *conp, u16 *p, int count)