[gedit-plugins/gnome-2-30] Fix background color of the commander entry



commit 37a1648c30cbc23d5425c34f6db29aeebf330800
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Mon May 3 13:43:40 2010 +0200

    Fix background color of the commander entry

 plugins/commander/commander/entry.py |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/plugins/commander/commander/entry.py b/plugins/commander/commander/entry.py
index 4e864d7..36ed4e1 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):
@@ -143,8 +144,22 @@ 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]