diff --git a/src/vte-private.h b/src/vte-private.h
index fc6a570..a53cbee 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -63,7 +63,7 @@ G_BEGIN_DECLS
  *   Colors set by SGR 256-color extension (38/48;5;index).
  *   These are direct indices into the color palette.
  *
- * 256 .. VTE_PALETTE_SIZE - 1 (262):
+ * 256 .. VTE_PALETTE_SIZE - 1 (261):
  *   Special values, such as default colors.
  *   These are direct indices into the color palette.
  *
@@ -71,6 +71,10 @@ G_BEGIN_DECLS
  *   Colors set by legacy escapes (30..37/40..47, 90..97/100..107).
  *   These are translated to 0 .. 15 before looking up in the palette, taking bold into account.
  *
+ * VTE_DIM_COLORS (2^10) .. :
+ *   Dimmed version of the above, for foreground colors.
+ *   Cell attributes can't have these colors.
+ *
  * VTE_RGB_COLOR (2^24) .. VTE_RGB_COLOR + 16Mi - 1 (2^25 - 1):
  *   Colors set by SGR truecolor extension (38/48;2;red;green;blue)
  *   These are direct RGB values.
@@ -80,7 +84,7 @@ G_BEGIN_DECLS
 #define VTE_LEGACY_FULL_COLOR_SET_SIZE	16
 #define VTE_COLOR_PLAIN_OFFSET		0
 #define VTE_COLOR_BRIGHT_OFFSET		8
-#define VTE_COLOR_DIM_OFFSET		16
+#define VTE_DIM_COLOR			(1 << 10)
 #define VTE_RGB_COLOR			(1 << 24)
 /* More color defines in vterowdata.h */
 
diff --git a/src/vte.c b/src/vte.c
index 2183ce7..ede3a93 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -289,10 +289,6 @@ G_DEFINE_TYPE_WITH_CODE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET,
                         G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, NULL))
 #endif
 
-/* Indexes in the "palette" color array for the dim colors.
- * Only the first %VTE_LEGACY_COLOR_SET_SIZE colors have dim versions.  */
-static const guchar corresponding_dim_index[] = {16,88,28,100,18,90,30,102};
-
 static void
 vte_g_array_fill(GArray *array, gconstpointer item, guint final_size)
 {
@@ -2389,23 +2385,6 @@ _vte_terminal_set_color_bold(VteTerminal *terminal,
 }
 
 /*
- * _vte_terminal_set_color_dim:
- * @terminal: a #VteTerminal
- * @dim: the new dim color
- *
- * Sets the color used to draw dim text in the default foreground color.
- */
-static void
-_vte_terminal_set_color_dim(VteTerminal *terminal,
-                            const PangoColor *dim)
-{
-	_vte_debug_print(VTE_DEBUG_MISC,
-			"Set dim color to (%04x,%04x,%04x).\n",
-			dim->red, dim->green, dim->blue);
-	_vte_terminal_set_color_internal(terminal, VTE_DIM_FG, VTE_COLOR_SOURCE_API, dim);
-}
-
-/*
  * _vte_terminal_set_color_foreground:
  * @terminal: a #VteTerminal
  * @foreground: the new foreground color
@@ -2642,12 +2621,6 @@ _vte_terminal_set_colors(VteTerminal *terminal,
 							   1.8,
 							   &color);
 				break;
-			case VTE_DIM_FG:
-				vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEFAULT_FG),
-							   _vte_terminal_get_color(terminal, VTE_DEFAULT_BG),
-							   0.5,
-							   &color);
-				break;
 			case VTE_HIGHLIGHT_BG:
 				unset = TRUE;
 				break;
@@ -2715,37 +2688,6 @@ vte_terminal_set_color_bold(VteTerminal *terminal,
 }
 
 /**
- * vte_terminal_set_color_dim:
- * @terminal: a #VteTerminal
- * @dim: (allow-none): the new dim color or %NULL
- *
- * Sets the color used to draw dim text in the default foreground color.
- * If @dim is %NULL then the default color is used.
- */
-void
-vte_terminal_set_color_dim(VteTerminal *terminal,
-                                const GdkRGBA *dim)
-{
-	PangoColor color;
-
-        g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
-	if (dim == NULL)
-	{
-		vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEFAULT_FG),
-					   _vte_terminal_get_color(terminal, VTE_DEFAULT_BG),
-					   0.5,
-					   &color);
-	}
-	else
-	{
-		_pango_color_from_rgba(&color, dim);
-	}
-
-	_vte_terminal_set_color_dim(terminal, &color);
-}
-
-/**
  * vte_terminal_set_color_foreground:
  * @terminal: a #VteTerminal
  * @foreground: the new foreground color
@@ -5904,10 +5846,22 @@ vte_terminal_copy_cb(GtkClipboard *clipboard, GtkSelectionData *data,
 static void
 vte_terminal_get_rgb_from_index(const VteTerminal *terminal, guint index, PangoColor *color)
 {
+        gboolean dim = FALSE;
+        if (!(index & VTE_RGB_COLOR) && (index & VTE_DIM_COLOR)) {
+                index &= ~VTE_DIM_COLOR;
+                dim = TRUE;
+        }
+
 	if (index >= VTE_LEGACY_COLORS_OFFSET && index < VTE_LEGACY_COLORS_OFFSET + VTE_LEGACY_FULL_COLOR_SET_SIZE)
 		index -= VTE_LEGACY_COLORS_OFFSET;
 	if (index < VTE_PALETTE_SIZE) {
 		memcpy(color, _vte_terminal_get_color(terminal, index), sizeof(PangoColor));
+                if (dim) {
+                        /* magic formula taken from xterm */
+                        color->red = color->red * 2 / 3;
+                        color->green = color->green * 2 / 3;
+                        color->blue = color->blue * 2 / 3;
+                }
 	} else if (index & VTE_RGB_COLOR) {
 		color->red = ((index >> 16) & 0xFF) * 257;
 		color->green = ((index >> 8) & 0xFF) * 257;
@@ -8729,13 +8683,12 @@ vte_terminal_determine_colors_internal(VteTerminal *terminal,
 		}
 	}
 
-	/* Handle half similarly */
-	if (cell->attr.half) {
-		if (fore == VTE_DEFAULT_FG)
-			fore = VTE_DIM_FG;
-		else if (fore >= VTE_LEGACY_COLORS_OFFSET && fore < VTE_LEGACY_COLORS_OFFSET + VTE_LEGACY_COLOR_SET_SIZE)
-			fore = corresponding_dim_index[fore - VTE_LEGACY_COLORS_OFFSET];
-	}
+        /* Handle dim colors.  Only apply to palette colors, dimming direct RGB wouldn't make sense.
+         * Apply to the foreground color only, but do this before handling reverse/highlight so that
+         * those can be used to dim the background instead. */
+        if (cell->attr.dim && !(fore & VTE_RGB_COLOR)) {
+	        fore |= VTE_DIM_COLOR;
+        }
 
 	/* Reverse cell? */
 	if (cell->attr.reverse) {
diff --git a/src/vterowdata.h b/src/vterowdata.h
index aed9412..7c58066 100644
--- a/src/vterowdata.h
+++ b/src/vterowdata.h
@@ -32,11 +32,10 @@ G_BEGIN_DECLS
 #define VTE_DEFAULT_FG			256
 #define VTE_DEFAULT_BG			257
 #define VTE_BOLD_FG			258
-#define VTE_DIM_FG			259
-#define VTE_HIGHLIGHT_FG		260
-#define VTE_HIGHLIGHT_BG		261
-#define VTE_CURSOR_BG			262
-#define VTE_PALETTE_SIZE		263
+#define VTE_HIGHLIGHT_FG		259
+#define VTE_HIGHLIGHT_BG		260
+#define VTE_CURSOR_BG			261
+#define VTE_PALETTE_SIZE		262
 
 /*
  * VteCellAttr: A single cell style attributes
@@ -64,7 +63,7 @@ typedef struct _VteCellAttr {
 
 	guint64 reverse: 1;
 	guint64 blink: 1;
-	guint64 half: 1;
+	guint64 dim: 1;		/* also known as faint, half intensity etc. */
 
 	guint64 invisible: 1;
         /* 1 bit unused */
diff --git a/src/vteseq.c b/src/vteseq.c
index c354cfc..3f7b598 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -1974,11 +1974,9 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
 			break;
 		case 1:
 			terminal->pvt->screen->defaults.attr.bold = 1;
-			terminal->pvt->screen->defaults.attr.half = 0;
 			break;
 		case 2:
-			terminal->pvt->screen->defaults.attr.half = 1;
-			terminal->pvt->screen->defaults.attr.bold = 0;
+			terminal->pvt->screen->defaults.attr.dim = 1;
 			break;
 		case 3:
 			terminal->pvt->screen->defaults.attr.italic = 1;
@@ -2001,7 +1999,7 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
 		case 21: /* Error in old versions of linux console. */
 		case 22: /* ECMA 48. */
 			terminal->pvt->screen->defaults.attr.bold = 0;
-			terminal->pvt->screen->defaults.attr.half = 0;
+			terminal->pvt->screen->defaults.attr.dim = 0;
 			break;
 		case 23:
 			terminal->pvt->screen->defaults.attr.italic = 0;
