[gedit-plugins] Fix background color of the commander entry



commit a4fde896c3ff07ef2689d98204d93594eb8cffea
Author: Jesse van den Kieboom <jesse icecrew nl>
Date:   Sat May 1 18:18:49 2010 +0200

    Fix background color of the commander entry

 plugins/commander/commander/entry.py |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/plugins/commander/commander/entry.py b/plugins/commander/commander/entry.py
index b9d53af..e887ee3 100644
--- a/plugins/commander/commander/entry.py
+++ b/plugins/commander/commander/entry.py
@@ -98,8 +98,9 @@ class Entry(gtk.EventBox):
 		ct.rectangle(evnt.area.x, evnt.area.y, evnt.area.width, evnt.area.height)
 
 		bg = self.background_color()
-		ct.set_source_rgb(bg[0], bg[1], bg[1])
+		ct.set_source_rgb(bg[0], bg[1], bg[2])
 		ct.fill()
+
 		return False
 
 	def on_expose(self, widget, evnt):
@@ -144,7 +145,21 @@ class Entry(gtk.EventBox):
 	def background_color(self):
 		bg = self._view.get_style().base[self._view.state]
 
-		return [bg.red / 65535.0 * 1.1, bg.green / 65535.0 * 1.1, bg.blue / 65535.0 * 0.9, 0.8]
+		vals = [bg.red, bg.green, bg.blue, 1]
+
+		for i in range(3):
+			val = vals[i] / 65535.0
+
+			if val < 0.0001:
+				vals[i] = 0.1
+			elif val > 0.9999:
+				vals[i] = 0.9
+			elif val < 0.1:
+				vals[i] = val * 1.2
+			else:
+				vals[i] = val * 0.8
+
+		return vals
 
 	def on_entry_focus_out(self, widget, evnt):
 		if self._entry.flags() & gtk.SENSITIVE:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]