diff -urN vte-0.16.9/src/vte.c vte-0.16.9-revcolor/src/vte.c
--- vte-0.16.9/src/vte.c	2007-09-02 00:42:52.000000000 -0400
+++ vte-0.16.9-revcolor/src/vte.c	2007-11-01 14:53:14.000000000 -0400
@@ -2327,6 +2327,40 @@
 }
 
 /**
+ * vte_terminal_set_color_reversed:
+ * @terminal: a #VteTerminal
+ * @reversed_background: the new color to use for reversed text
+ *
+ * Sets the background color for text which is reversed (attr.reverse is set).
+ * If %NULL, reversed text will be drawn with foreground and background colors
+ * reversed.
+ *
+ * Since 0.16.10
+ *
+ */
+void
+vte_terminal_set_color_reversed(VteTerminal *terminal,
+				const GdkColor *reversed_background)
+{
+	g_return_if_fail(VTE_IS_TERMINAL(terminal));
+
+	if (reversed_background != NULL) {
+		_vte_debug_print(VTE_DEBUG_MISC,
+				"Set reversed color to (%04x,%04x,%04x).\n",
+				reversed_background->red,
+				reversed_background->green,
+				reversed_background->blue);
+		vte_terminal_set_color_internal(terminal, VTE_REV_BG,
+						reversed_background);
+		terminal->pvt->reversed_color_set = TRUE;
+	} else {
+		_vte_debug_print(VTE_DEBUG_MISC,
+				"Cleared reversed color.\n");
+		terminal->pvt->reversed_color_set = FALSE;
+	}
+}
+
+/**
  * vte_terminal_set_colors
  * @terminal: a #VteTerminal
  * @foreground: the new foreground color, or %NULL
@@ -8018,8 +8052,13 @@
 		*back = VTE_DEF_HL;
 	} else
 	if (reverse ^ ((cell != NULL) && (cell->attr.reverse))) {
-		*fore = cell ? cell->attr.back : VTE_DEF_BG;
-		*back = cell ? cell->attr.fore : VTE_DEF_FG;
+		if (terminal->pvt->reversed_color_set) {
+			*fore = cell ? cell->attr.fore : VTE_DEF_FG;
+			*back = VTE_REV_BG;
+		} else {
+			*fore = cell ? cell->attr.back : VTE_DEF_BG;
+			*back = cell ? cell->attr.fore : VTE_DEF_FG;
+		}
 	} else {
 		*fore = cell ? cell->attr.fore : VTE_DEF_FG;
 		*back = cell ? cell->attr.back : VTE_DEF_BG;
diff -urN vte-0.16.9/src/vte.h vte-0.16.9-revcolor/src/vte.h
--- vte-0.16.9/src/vte.h	2007-08-30 18:29:56.000000000 -0400
+++ vte-0.16.9-revcolor/src/vte.h	2007-11-01 11:40:11.000000000 -0400
@@ -257,6 +257,8 @@
 				   const GdkColor *cursor_background);
 void vte_terminal_set_color_highlight(VteTerminal *terminal,
 				      const GdkColor *highlight_background);
+void vte_terminal_set_color_reversed(VteTerminal *terminal,
+				     const GdkColor *reversed_background);
 void vte_terminal_set_colors(VteTerminal *terminal,
 			     const GdkColor *foreground,
 			     const GdkColor *background,
diff -urN vte-0.16.9/src/vte-private.h vte-0.16.9-revcolor/src/vte-private.h
--- vte-0.16.9/src/vte-private.h	2007-08-30 18:29:56.000000000 -0400
+++ vte-0.16.9-revcolor/src/vte-private.h	2007-11-01 11:46:38.000000000 -0400
@@ -68,6 +68,7 @@
 #define VTE_DIM_FG			259
 #define VTE_DEF_HL                      260
 #define VTE_CUR_BG			261
+#define VTE_REV_BG			262
 
 #define VTE_SATURATION_MAX		10000
 #define VTE_SCROLLBACK_INIT		100
@@ -333,9 +334,10 @@
 	gboolean palette_initialized;
 	gboolean highlight_color_set;
 	gboolean cursor_color_set;
+	gboolean reversed_color_set;
 	struct vte_palette_entry {
 		guint16 red, green, blue;
-	} palette[VTE_CUR_BG + 1];
+	} palette[VTE_REV_BG + 1];
 
 	/* Mouse cursors. */
 	gboolean mouse_cursor_visible;
