From d5225a8338122cec1017412fa767024ec4971122 Mon Sep 17 00:00:00 2001
From: Nathan Gray <nathangray.bsc@gmail.com>
Date: Mon, 11 Apr 2016 16:42:50 +0000
Subject: [PATCH] Change portlet header text color to contrast with selected
 color

---
 api/js/etemplate/et2_widget_portlet.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/api/js/etemplate/et2_widget_portlet.js b/api/js/etemplate/et2_widget_portlet.js
index a50d31a69b..134a9c87a4 100644
--- a/api/js/etemplate/et2_widget_portlet.js
+++ b/api/js/etemplate/et2_widget_portlet.js
@@ -162,6 +162,10 @@ var et2_portlet = (function(){ "use strict"; return et2_valueWidget.extend(
 		this._super.apply(this, arguments);
 	},
 
+	doLoadingFinished: function() {
+		this.set_color(this.options.color);
+	},
+
 	/**
 	 * If anyone asks, return the content node, so content goes inside
 	 */
@@ -364,7 +368,9 @@ var et2_portlet = (function(){ "use strict"; return et2_valueWidget.extend(
 	 */
 	set_color: function(color)
 	{
+		this.options.color = color;
 		this.header.css("backgroundColor", color);
+		this.header.css('color', jQuery.Color(this.header.css("backgroundColor")).lightness() > 0.5 ? 'black':'white');
 		this.content.css("backgroundColor", color);
 	},