diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index 2c9912f..5388ce4 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -212,6 +212,15 @@ load_contact (EABContactDisplay *display)
 	formatter = eab_contact_formatter_new (
 			display->priv->mode,
 			display->priv->show_maps);
+	g_object_set (
+		G_OBJECT (formatter),
+		"style-context", gtk_widget_get_style_context (GTK_WIDGET (display)),
+		"state-flags", gtk_widget_get_state_flags (GTK_WIDGET (display)),
+		NULL);
+
+	g_signal_connect (
+		display, "style-updated",
+		G_CALLBACK (e_web_view_reload), NULL);
 
 	display->priv->formatter_cancellable = g_cancellable_new ();
 
diff --git a/addressbook/gui/widgets/eab-contact-formatter.c b/addressbook/gui/widgets/eab-contact-formatter.c
index ce6825a..11fdefe 100644
--- a/addressbook/gui/widgets/eab-contact-formatter.c
+++ b/addressbook/gui/widgets/eab-contact-formatter.c
@@ -49,7 +49,9 @@ G_DEFINE_TYPE (
 enum {
 	PROP_0,
         PROP_DISPLAY_MODE,
-        PROP_RENDER_MAPS
+        PROP_RENDER_MAPS,
+	PROP_STYLE_CONTEXT,
+	PROP_STATE_FLAGS
 };
 
 struct _EABContactFormatterPrivate {
@@ -58,6 +60,9 @@ struct _EABContactFormatterPrivate {
 
         EABContactDisplayMode mode;
         gboolean render_maps;
+
+	GtkStyleContext *style_context;
+	GtkStateFlags state_flags;
 };
 
 static struct {
@@ -97,16 +102,6 @@ common_location[] =
 "  img#contact-photo { float: left; }\n" \
 "  div#contact-name { float: left; margin-left: 20px; }\n" \
 "</style>\n" \
-"<script type=\"text/javascript\">\n" \
-"function collapse_list (obj, listId) {\n" \
-"	var l = document.getElementById (listId);\n" \
-"	if (l.style.display == \"none\") {\n" \
-"		l.style.display = \"block\"; obj.src = obj.src.substr (0, obj.src.lastIndexOf (\"/\")) + \"/minus.png\";\n" \
-"	} else {\n" \
-"		l.style.display = \"none\"; obj.src = obj.src.substr (0, obj.src.lastIndexOf (\"/\")) + \"/plus.png\";\n" \
-"   }\n" \
-"}\n" \
-"</script>\n" \
 "</head>\n"
 
 static gboolean
@@ -772,8 +767,18 @@ static void
 render_normal (EABContactFormatter *formatter,
                GString *buffer)
 {
+	GdkRGBA bg, text;
+
+	gtk_style_context_get_background_color (
+		formatter->priv->style_context,
+		formatter->priv->state_flags, &bg);
+	gtk_style_context_get_color (
+		formatter->priv->style_context,
+		formatter->priv->state_flags, &text);
 	g_string_append (buffer, HTML_HEADER);
-	g_string_append (buffer, "<body>");
+	g_string_append_printf (
+		buffer, "<body bgcolor=\"#%06x\" text=\"#%06x\">",
+		e_rgba_to_value (&bg), e_rgba_to_value (&text));
 
 	if (formatter->priv->contact) {
 
@@ -1070,6 +1075,14 @@ eab_contact_formatter_set_property (GObject *object,
 			eab_contact_formatter_set_render_maps (
 				formatter, g_value_get_boolean (value));
 			return;
+		case PROP_STYLE_CONTEXT:
+			eab_contact_formatter_set_style_context (
+				formatter, g_value_get_object (value));
+			return;
+		case PROP_STATE_FLAGS:
+			eab_contact_formatter_set_state_flags (
+				formatter, g_value_get_uint (value));
+			return;
 	}
 
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1094,6 +1107,16 @@ eab_contact_formatter_get_property (GObject *object,
 				eab_contact_formatter_get_render_maps (
 					formatter));
 			return;
+		case PROP_STYLE_CONTEXT:
+			g_value_set_object (value,
+				eab_contact_formatter_get_style_context (
+					formatter));
+			return;
+		case PROP_STATE_FLAGS:
+			g_value_set_uint (value,
+				eab_contact_formatter_get_state_flags (
+					formatter));
+			return;
 	}
 
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1147,6 +1170,28 @@ eab_contact_formatter_class_init (EABContactFormatterClass *class)
 			"",
 			FALSE,
 			G_PARAM_READWRITE));
+
+	g_object_class_install_property (
+		object_class,
+		PROP_STYLE_CONTEXT,
+		g_param_spec_object (
+			"style-context",
+		        NULL,
+		        NULL,
+		        GTK_TYPE_STYLE_CONTEXT,
+		        G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+	g_object_class_install_property (
+		object_class,
+		PROP_STATE_FLAGS,
+		g_param_spec_uint (
+			"state-flags",
+		        NULL,
+		        NULL,
+			0,
+			G_MAXUINT,
+			0,
+			G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 }
 
 static void
@@ -1216,6 +1261,55 @@ eab_contact_formatter_get_render_maps (EABContactFormatter *formatter)
 }
 
 void
+eab_contact_formatter_set_style_context (EABContactFormatter *formatter,
+					 GtkStyleContext *context)
+{
+	g_return_if_fail (EAB_IS_CONTACT_FORMATTER (formatter));
+
+	if (formatter->priv->style_context == context) {
+		return;
+	}
+
+	g_clear_object (&formatter->priv->style_context);
+
+	if (context != NULL) {
+		formatter->priv->style_context = g_object_ref (context);
+	}
+
+	g_object_notify (G_OBJECT (formatter), "style-context");
+}
+
+GtkStyleContext *
+eab_contact_formatter_get_style_context (EABContactFormatter *formatter)
+{
+	g_return_val_if_fail (EAB_IS_CONTACT_FORMATTER (formatter), NULL);
+
+	return formatter->priv->style_context;
+}
+
+void
+eab_contact_formatter_set_state_flags (EABContactFormatter *formatter,
+				       GtkStateFlags state_flags)
+{
+	g_return_if_fail (EAB_IS_CONTACT_FORMATTER (formatter));
+
+	if (formatter->priv->state_flags == state_flags)
+		return;
+
+	formatter->priv->state_flags = state_flags;
+
+	g_object_notify (G_OBJECT (formatter), "state-flags");
+}
+
+GtkStateFlags
+eab_contact_formatter_get_state_flags (EABContactFormatter *formatter)
+{
+	g_return_val_if_fail (EAB_IS_CONTACT_FORMATTER (formatter), 0);
+
+	return formatter->priv->state_flags;
+}
+
+void
 eab_contact_formatter_format_contact_sync (EABContactFormatter *formatter,
                                            EContact *contact,
                                            CamelStream *stream,
diff --git a/addressbook/gui/widgets/eab-contact-formatter.h b/addressbook/gui/widgets/eab-contact-formatter.h
index 7348f89..5190ff9 100644
--- a/addressbook/gui/widgets/eab-contact-formatter.h
+++ b/addressbook/gui/widgets/eab-contact-formatter.h
@@ -62,6 +62,19 @@ EABContactFormatter*
 		eab_contact_formatter_new	(EABContactDisplayMode mode,
 						 gboolean render_maps);
 
+void		eab_contact_formatter_set_style_context
+						(EABContactFormatter *formatter,
+						 GtkStyleContext *context);
+GtkStyleContext*
+		eab_contact_formatter_get_style_context
+						(EABContactFormatter *formatter);
+
+void		eab_contact_formatter_set_state_flags
+						(EABContactFormatter *formatter,
+						 GtkStateFlags state_flags);
+GtkStateFlags	eab_contact_formatter_get_state_flags
+						(EABContactFormatter *formatter);
+
 void            eab_contact_formatter_set_render_maps
                                                 (EABContactFormatter *formatter,
                                                  gboolean render_maps);
diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c
index 0cd65b0..3f43320 100644
--- a/calendar/gui/e-cal-component-preview.c
+++ b/calendar/gui/e-cal-component-preview.c
@@ -175,7 +175,8 @@ timet_to_str_with_zone (ECalComponentDateTime *dt,
 }
 
 static void
-cal_component_preview_write_html (GString *buffer,
+cal_component_preview_write_html (ECalComponentPreview *preview,
+				  GString *buffer,
                                   ECalClient *client,
                                   ECalComponent *comp,
                                   icaltimezone *default_zone,
@@ -191,14 +192,27 @@ cal_component_preview_write_html (GString *buffer,
 	icalproperty_status status;
 	const gchar *location;
 	gint *priority_value;
+	GdkRGBA bg, text_color;
+	GtkStyleContext *style_context;
+	GtkStateFlags state_flags;
 
 	g_return_if_fail (E_IS_CAL_COMPONENT (comp));
 
 	/* write document header */
 	e_cal_component_get_summary (comp, &text);
 
+	style_context = gtk_widget_get_style_context (GTK_WIDGET (preview));
+	state_flags = gtk_widget_get_state_flags (GTK_WIDGET (preview));
+	gtk_style_context_get_background_color (style_context, state_flags, &bg);
+	gtk_style_context_get_color (style_context, state_flags, &text_color);
+	g_signal_connect (
+		preview, "style-updated",
+		G_CALLBACK (e_web_view_reload), NULL);
+
 	g_string_append (buffer, HTML_HEADER);
-	g_string_append (buffer, "<body>");
+	g_string_append_printf (
+		buffer, "<body bgcolor=\"#%06x\" text=\"#%06x\">",
+		e_rgba_to_value (&bg), e_rgba_to_value (&text_color));
 
 	if (text.value)
 		g_string_append_printf (buffer, "<h2>%s</h2>", text.value);
@@ -425,7 +439,7 @@ e_cal_component_preview_display (ECalComponentPreview *preview,
 
 	buffer = g_string_sized_new (4096);
 	cal_component_preview_write_html (
-		buffer, client, comp, zone, use_24_hour_format);
+		preview, buffer, client, comp, zone, use_24_hour_format);
 	e_web_view_load_string (E_WEB_VIEW (preview), buffer->str);
 	g_string_free (buffer, TRUE);
 }
