diff --git a/src/caps.c b/src/caps.c
index e6c235c..ea576fa 100644
--- a/src/caps.c
+++ b/src/caps.c
@@ -223,7 +223,7 @@ const char _vte_xterm_capability_strings[] =
         ENTRY(OSC "7;%s" BEL, "set-current-directory-uri")
         ENTRY(OSC "10;%s" BEL, "change-foreground-color-bel")
         ENTRY(OSC "11;%s" BEL, "change-background-color-bel")
-        ENTRY(OSC "12;%s" BEL, "change-cursor-color-bel")
+        ENTRY(OSC "12;%s" BEL, "change-cursor-background-color-bel")
         ENTRY(OSC "13;%s" BEL, "change-mouse-cursor-foreground-color-bel")
         ENTRY(OSC "14;%s" BEL, "change-mouse-cursor-background-color-bel")
         ENTRY(OSC "15;%s" BEL, "change-tek-foreground-color-bel")
@@ -231,6 +231,7 @@ const char _vte_xterm_capability_strings[] =
         ENTRY(OSC "17;%s" BEL, "change-highlight-background-color-bel")
         ENTRY(OSC "18;%s" BEL, "change-tek-cursor-color-bel")
         ENTRY(OSC "19;%s" BEL, "change-highlight-foreground-color-bel")
+        ENTRY(OSC "20;%s" BEL, "change-cursor-foreground-color-bel")
         ENTRY(OSC "46;%s" BEL, "change-logfile")
         ENTRY(OSC "50;#%d" BEL, "change-font-number")
         ENTRY(OSC "50;%s" BEL, "change-font-name")
@@ -238,7 +239,7 @@ const char _vte_xterm_capability_strings[] =
         ENTRY(OSC "104;%m" BEL, "reset-color")
         ENTRY(OSC "110" BEL, "reset-foreground-color")
         ENTRY(OSC "111" BEL, "reset-background-color")
-        ENTRY(OSC "112" BEL, "reset-cursor-color")
+        ENTRY(OSC "112" BEL, "reset-cursor-background-color")
         ENTRY(OSC "113" BEL, "reset-mouse-cursor-foreground-color")
         ENTRY(OSC "114" BEL, "reset-mouse-cursor-background-color")
         ENTRY(OSC "115" BEL, "reset-tek-foreground-color")
@@ -246,6 +247,7 @@ const char _vte_xterm_capability_strings[] =
         ENTRY(OSC "117" BEL, "reset-highlight-background-color")
         ENTRY(OSC "118" BEL, "reset-tek-cursor-color")
         ENTRY(OSC "119" BEL, "reset-highlight-foreground-color")
+        ENTRY(OSC "120" BEL, "reset-cursor-foreground-color")
 
         COMMENT(/* Set text parameters, ST-terminated versions. */)
         ENTRY(OSC ";%s" ST, "set-icon-and-window-title") COMMENT(/* undocumented default */)
@@ -258,7 +260,7 @@ const char _vte_xterm_capability_strings[] =
         ENTRY(OSC "7;%s" ST, "set-current-directory-uri")
         ENTRY(OSC "10;%s" ST, "change-foreground-color-st")
         ENTRY(OSC "11;%s" ST, "change-background-color-st")
-        ENTRY(OSC "12;%s" ST, "change-cursor-color-st")
+        ENTRY(OSC "12;%s" ST, "change-cursor-background-color-st")
         ENTRY(OSC "13;%s" ST, "change-mouse-cursor-foreground-color-st")
         ENTRY(OSC "14;%s" ST, "change-mouse-cursor-background-color-st")
         ENTRY(OSC "15;%s" ST, "change-tek-foreground-color-st")
@@ -266,6 +268,7 @@ const char _vte_xterm_capability_strings[] =
         ENTRY(OSC "17;%s" ST, "change-highlight-background-color-st")
         ENTRY(OSC "18;%s" ST, "change-tek-cursor-color-st")
         ENTRY(OSC "19;%s" ST, "change-highlight-foreground-color-st")
+        ENTRY(OSC "20;%s" ST, "change-cursor-foreground-color-st")
         ENTRY(OSC "46;%s" ST, "change-logfile")
         ENTRY(OSC "50;#%d" ST, "change-font-number")
         ENTRY(OSC "50;%s" ST, "change-font-name")
@@ -273,7 +276,7 @@ const char _vte_xterm_capability_strings[] =
         ENTRY(OSC "104;%m" ST, "reset-color")
         ENTRY(OSC "110" ST, "reset-foreground-color")
         ENTRY(OSC "111" ST, "reset-background-color")
-        ENTRY(OSC "112" ST, "reset-cursor-color")
+        ENTRY(OSC "112" ST, "reset-cursor-background-color")
         ENTRY(OSC "113" ST, "reset-mouse-cursor-foreground-color")
         ENTRY(OSC "114" ST, "reset-mouse-cursor-background-color")
         ENTRY(OSC "115" ST, "reset-tek-foreground-color")
@@ -281,6 +284,7 @@ const char _vte_xterm_capability_strings[] =
         ENTRY(OSC "117" ST, "reset-highlight-background-color")
         ENTRY(OSC "118" ST, "reset-tek-cursor-color")
         ENTRY(OSC "119" ST, "reset-highlight-foreground-color")
+        ENTRY(OSC "120" ST, "reset-cursor-foreground-color")
 
         COMMENT(/* These may be bogus, I can't find docs for them anywhere (#104154). */)
         ENTRY(OSC "21;%s" BEL, "set-text-property-21")
diff --git a/src/vte.c b/src/vte.c
index 5f5f107..5daa940 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -2256,7 +2256,7 @@ vte_terminal_new(void)
 /*
  * Get the actually used color from the palette.
  * The return value can be NULL only if entry is one of VTE_CURSOR_BG,
- * VTE_HIGHLIGHT_BG or VTE_HIGHLIGHT_FG.
+ * VTE_CURSOR_FG, VTE_HIGHLIGHT_BG or VTE_HIGHLIGHT_FG.
  */
 PangoColor *
 _vte_terminal_get_color(const VteTerminal *terminal, int entry)
@@ -2319,7 +2319,7 @@ _vte_terminal_set_color_internal(VteTerminal *terminal,
    }
 
    /* and redraw */
-   if (entry == VTE_CURSOR_BG)
+   if (entry == VTE_CURSOR_BG || entry == VTE_CURSOR_FG)
        _vte_invalidate_cursor_once(terminal, FALSE);
    else
        _vte_invalidate_all (terminal);
@@ -2450,8 +2450,9 @@ _vte_terminal_set_background_alpha(VteTerminal *terminal,
  * @terminal: a #VteTerminal
  * @cursor_background: (allow-none): the new color to use for the text cursor, or %NULL
  *
- * Sets the background color for text which is under the cursor.  If %NULL, text
- * under the cursor will be drawn with foreground and background colors
+ * Sets the background color for text which is under the cursor.  If %NULL,
+ * it is unset. If neither cursor background nor cursor foreground are set,
+ * text under the cursor will be drawn with foreground and background colors
  * reversed.
  */
 static void
@@ -2460,18 +2461,45 @@ _vte_terminal_set_color_cursor(VteTerminal *terminal,
 {
    if (cursor_background != NULL) {
        _vte_debug_print(VTE_DEBUG_MISC,
-               "Set cursor color to (%04x,%04x,%04x).\n",
+               "Set cursor background color to (%04x,%04x,%04x).\n",
                cursor_background->red,
                cursor_background->green,
                cursor_background->blue);
    } else {
        _vte_debug_print(VTE_DEBUG_MISC,
-               "Reset cursor color.\n");
+               "Reset cursor background color.\n");
    }
    _vte_terminal_set_color_internal(terminal, VTE_CURSOR_BG, VTE_COLOR_SOURCE_API, cursor_background);
 }
 
 /*
+ * _vte_terminal_set_color_cursor_foreground:
+ * @terminal: a #VteTerminal
+ * @cursor_foreground: (allow-none): the new color to use for the text cursor, or %NULL
+ *
+ * Sets the foreground color for text which is under the cursor.  If %NULL,
+ * it is unset. If neither cursor background nor cursor foreground are set,
+ * text under the cursor will be drawn with foreground and background colors
+ * reversed.
+ */
+static void
+_vte_terminal_set_color_cursor_foreground(VteTerminal *terminal,
+                                          const PangoColor *cursor_foreground)
+{
+   if (cursor_foreground != NULL) {
+       _vte_debug_print(VTE_DEBUG_MISC,
+               "Set cursor foreground color to (%04x,%04x,%04x).\n",
+               cursor_foreground->red,
+               cursor_foreground->green,
+               cursor_foreground->blue);
+   } else {
+       _vte_debug_print(VTE_DEBUG_MISC,
+               "Reset cursor foreground color.\n");
+   }
+   _vte_terminal_set_color_internal(terminal, VTE_CURSOR_FG, VTE_COLOR_SOURCE_API, cursor_foreground);
+}
+
+/*
  * _vte_terminal_set_color_highlight:
  * @terminal: a #VteTerminal
  * @highlight_background: (allow-none): the new color to use for highlighted text, or %NULL
@@ -2634,6 +2662,9 @@ _vte_terminal_set_colors(VteTerminal *terminal,
            case VTE_CURSOR_BG:
                unset = TRUE;
                break;
+           case VTE_CURSOR_FG:
+               unset = TRUE;
+               break;
            }
 
        /* Override from the supplied palette if there is one. */
@@ -2739,8 +2770,9 @@ vte_terminal_set_color_background(VteTerminal *terminal,
  * @terminal: a #VteTerminal
  * @cursor_background: (allow-none): the new color to use for the text cursor, or %NULL
  *
- * Sets the background color for text which is under the cursor.  If %NULL, text
- * under the cursor will be drawn with foreground and background colors
+ * Sets the background color for text which is under the cursor.  If %NULL,
+ * it is unset. If neither cursor background nor cursor foreground are set,
+ * text under the cursor will be drawn with foreground and background colors
  * reversed.
  */
 void
@@ -2756,6 +2788,28 @@ vte_terminal_set_color_cursor(VteTerminal *terminal,
 }
 
 /**
+ * vte_terminal_set_color_cursor_foreground:
+ * @terminal: a #VteTerminal
+ * @cursor_foreground: (allow-none): the new color to use for the text cursor, or %NULL
+ *
+ * Sets the foreground color for text which is under the cursor.  If %NULL,
+ * it is unset. If neither cursor background nor cursor foreground are set,
+ * text under the cursor will be drawn with foreground and background colors
+ * reversed.
+ */
+void
+vte_terminal_set_color_cursor_foreground(VteTerminal *terminal,
+                  const GdkRGBA *cursor_foreground)
+{
+        PangoColor color;
+
+        g_return_if_fail(VTE_IS_TERMINAL(terminal));
+
+   _vte_terminal_set_color_cursor_foreground(terminal,
+                                       _pango_color_from_rgba(&color, cursor_foreground));
+}
+
+/**
  * vte_terminal_set_color_highlight:
  * @terminal: a #VteTerminal
  * @highlight_background: (allow-none): the new color to use for highlighted text, or %NULL
@@ -8751,12 +8805,19 @@ vte_terminal_determine_colors_internal(VteTerminal *terminal,
            swap (&fore, &back);
    }
 
-   /* Cursor: use cursor back, or inverse */
+   /* Cursor: use cursor back/fore, or inverse */
    if (cursor) {
        /* XXX what if cursor back is same color as current back? */
-       if (_vte_terminal_get_color(terminal, VTE_CURSOR_BG) != NULL)
+       gboolean do_swap = TRUE;
+       if (_vte_terminal_get_color(terminal, VTE_CURSOR_BG) != NULL) {
            back = VTE_CURSOR_BG;
-       else
+           do_swap = FALSE;
+       }
+       if (_vte_terminal_get_color(terminal, VTE_CURSOR_FG) != NULL) {
+           fore = VTE_CURSOR_FG;
+           do_swap = FALSE;
+       }
+       if (do_swap)
            swap (&fore, &back);
    }
 
diff --git a/src/vteapp.c b/src/vteapp.c
index a4fe9d7..bb0aa52 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -582,7 +582,8 @@ main(int argc, char **argv)
    char *cursor_shape_string = NULL;
    char *scrollbar_policy_string = NULL;
         char *border_width_string = NULL;
-        char *cursor_color_string = NULL;
+        char *cursor_foreground_color_string = NULL;
+        char *cursor_background_color_string = NULL;
         char *highlight_foreground_color_string = NULL;
         char *highlight_background_color_string = NULL;
         char **dingus = NULL;
@@ -679,9 +680,14 @@ main(int argc, char **argv)
            "Cursor blink mode (system|on|off)", "MODE"
        },
        {
-           "cursor-color", 0, 0,
-           G_OPTION_ARG_STRING, &cursor_color_string,
-           "Enable a colored cursor", NULL
+           "cursor-foreground-color", 0, 0,
+           G_OPTION_ARG_STRING, &cursor_foreground_color_string,
+           "Enable foreground color of cursor", NULL
+       },
+       {
+           "cursor-background-color", 0, 0,
+           G_OPTION_ARG_STRING, &cursor_background_color_string,
+           "Enable background color of cursor", NULL
        },
        {
            "cursor-shape", 0, 0,
@@ -923,11 +929,17 @@ main(int argc, char **argv)
 
    vte_terminal_set_colors(terminal, &fore, &back, NULL, 0);
 
-   if (cursor_color_string) {
+   if (cursor_foreground_color_string) {
+       GdkRGBA rgba;
+       if (parse_color (cursor_foreground_color_string, &rgba))
+           vte_terminal_set_color_cursor_foreground(terminal, &rgba);
+       g_free(cursor_foreground_color_string);
+   }
+   if (cursor_background_color_string) {
                 GdkRGBA rgba;
-                if (parse_color (cursor_color_string, &rgba))
+                if (parse_color (cursor_background_color_string, &rgba))
                         vte_terminal_set_color_cursor(terminal, &rgba);
-                g_free(cursor_color_string);
+                g_free(cursor_background_color_string);
    }
    if (highlight_foreground_color_string) {
                 GdkRGBA rgba;
diff --git a/src/vterowdata.h b/src/vterowdata.h
index 7c58066..d3fc044 100644
--- a/src/vterowdata.h
+++ b/src/vterowdata.h
@@ -34,8 +34,9 @@ G_BEGIN_DECLS
 #define VTE_BOLD_FG            258
 #define VTE_HIGHLIGHT_FG       259
 #define VTE_HIGHLIGHT_BG       260
-#define VTE_CURSOR_BG          261
-#define VTE_PALETTE_SIZE       262
+#define VTE_CURSOR_FG          261
+#define VTE_CURSOR_BG          262
+#define VTE_PALETTE_SIZE       263
 
 /*
  * VteCellAttr: A single cell style attributes
diff --git a/src/vteseq-n.gperf b/src/vteseq-n.gperf
index 208ab19..030b1a9 100644
--- a/src/vteseq-n.gperf
+++ b/src/vteseq-n.gperf
@@ -83,9 +83,12 @@ struct vteseq_n_struct {
 #"end-of-guarded-area", VTE_SEQUENCE_HANDLER_NULL
 "utf-8-character-set", VTE_SEQUENCE_HANDLER(vte_sequence_handler_utf_8_character_set)
 "window-manipulation", VTE_SEQUENCE_HANDLER(vte_sequence_handler_window_manipulation)
-"change-cursor-color-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_color_bel)
-"change-cursor-color-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_color_st)
-"reset-cursor-color", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_cursor_color)
+"change-cursor-background-color-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_background_color_bel)
+"change-cursor-background-color-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_background_color_st)
+"reset-cursor-background-color", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_cursor_background_color)
+"change-cursor-foreground-color-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_foreground_color_bel)
+"change-cursor-foreground-color-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_foreground_color_st)
+"reset-cursor-foreground-color", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_cursor_foreground_color)
 "character-attributes", VTE_SEQUENCE_HANDLER(vte_sequence_handler_character_attributes)
 "device-status-report", VTE_SEQUENCE_HANDLER(vte_sequence_handler_device_status_report)
 "set-scrolling-region", VTE_SEQUENCE_HANDLER(vte_sequence_handler_set_scrolling_region)
diff --git a/src/vteseq.c b/src/vteseq.c
index 3f7b598..a6f2367 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -3093,29 +3093,52 @@ vte_sequence_handler_reset_background_color (VteTerminal *terminal, GValueArray
    _vte_terminal_set_color_internal(terminal, VTE_DEFAULT_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
 }
 
-/* Change the color of the cursor, BEL terminated */
+/* Change the cursor background color, BEL terminated */
 static void
-vte_sequence_handler_change_cursor_color_bel (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_cursor_background_color_bel (VteTerminal *terminal, GValueArray *params)
 {
    vte_sequence_handler_change_special_color_internal (terminal, params,
                                VTE_CURSOR_BG, VTE_DEFAULT_FG, 12, BEL);
 }
 
-/* Change the color of the cursor, ST terminated */
+/* Change the cursor background color, ST terminated */
 static void
-vte_sequence_handler_change_cursor_color_st (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_cursor_background_color_st (VteTerminal *terminal, GValueArray *params)
 {
    vte_sequence_handler_change_special_color_internal (terminal, params,
                                VTE_CURSOR_BG, VTE_DEFAULT_FG, 12, ST);
 }
 
-/* Reset the color of the cursor */
+/* Reset the cursor background color */
 static void
-vte_sequence_handler_reset_cursor_color (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_reset_cursor_background_color (VteTerminal *terminal, GValueArray *params)
 {
    _vte_terminal_set_color_internal(terminal, VTE_CURSOR_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
 }
 
+/* Change the cursor foreground color, BEL terminated */
+static void
+vte_sequence_handler_change_cursor_foreground_color_bel (VteTerminal *terminal, GValueArray *params)
+{
+   vte_sequence_handler_change_special_color_internal (terminal, params,
+                               VTE_CURSOR_FG, VTE_DEFAULT_BG, 12, BEL);
+}
+
+/* Change the cursor foreground color, ST terminated */
+static void
+vte_sequence_handler_change_cursor_foreground_color_st (VteTerminal *terminal, GValueArray *params)
+{
+   vte_sequence_handler_change_special_color_internal (terminal, params,
+                               VTE_CURSOR_FG, VTE_DEFAULT_BG, 12, ST);
+}
+
+/* Reset the cursor foreground color */
+static void
+vte_sequence_handler_reset_cursor_foreground_color (VteTerminal *terminal, GValueArray *params)
+{
+   _vte_terminal_set_color_internal(terminal, VTE_CURSOR_FG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+}
+
 /* Change the highlight background color, BEL terminated */
 static void
 vte_sequence_handler_change_highlight_background_color_bel (VteTerminal *terminal, GValueArray *params)
diff --git a/src/vteterminal.h b/src/vteterminal.h
index 7e36708..1b611b3 100644
--- a/src/vteterminal.h
+++ b/src/vteterminal.h
@@ -203,6 +203,8 @@ void vte_terminal_set_color_background(VteTerminal *terminal,
                                        const GdkRGBA *background) _VTE_GNUC_NONNULL(1) _VTE_GNUC_NONNULL(2);
 void vte_terminal_set_color_cursor(VteTerminal *terminal,
                                    const GdkRGBA *cursor_background) _VTE_GNUC_NONNULL(1);
+void vte_terminal_set_color_cursor_foreground(VteTerminal *terminal,
+                                              const GdkRGBA *cursor_foreground) _VTE_GNUC_NONNULL(1);
 void vte_terminal_set_color_highlight(VteTerminal *terminal,
                                       const GdkRGBA *highlight_background) _VTE_GNUC_NONNULL(1);
 void vte_terminal_set_color_highlight_foreground(VteTerminal *terminal,
