diff --git a/pgadmin/ctl/ctlSQLBox.cpp b/pgadmin/ctl/ctlSQLBox.cpp
index 22778b4..11ab793 100644
--- a/pgadmin/ctl/ctlSQLBox.cpp
+++ b/pgadmin/ctl/ctlSQLBox.cpp
@@ -111,7 +111,8 @@ void ctlSQLBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
 	}
 
 	// Margin style
-	StyleSetBackground(wxSTC_STYLE_LINENUMBER, wxColour(0xDD, 0xDD, 0xDD));
+	StyleSetBackground(wxSTC_STYLE_LINENUMBER, settings->GetSQLMarginBackgroundColour());
+
     // Brace maching styles
     StyleSetBackground(34, wxColour(0x99, 0xF9, 0xFF));
     StyleSetBackground(35, wxColour(0xFF, 0xCF, 0x27));
diff --git a/pgadmin/frm/frmOptions.cpp b/pgadmin/frm/frmOptions.cpp
index 4e25374..bfa3c14 100644
--- a/pgadmin/frm/frmOptions.cpp
+++ b/pgadmin/frm/frmOptions.cpp
@@ -83,6 +83,7 @@
 #define pickerSQLForegroundColour        CTRL_COLOURPICKER("pickerSQLForegroundColour")
 #define stSQLCustomBackgroundColour      CTRL_STATIC("stSQLCustomBackgroundColour") 
 #define stSQLCustomForegroundColour      CTRL_STATIC("stSQLCustomForegroundColour") 
+#define pickerSQLMarginBackgroundColour  CTRL_COLOURPICKER("pickerSQLMarginBackgroundColour")
 #define pickerSQLColour1            CTRL_COLOURPICKER("pickerSQLColour1")
 #define pickerSQLColour2            CTRL_COLOURPICKER("pickerSQLColour2")
 #define pickerSQLColour3            CTRL_COLOURPICKER("pickerSQLColour3")
@@ -424,6 +425,8 @@ void frmOptions::UpdateColourControls()
 		pickerSQLForegroundColour->SetColour(settings->GetSQLBoxColourForeground());
 		stSQLCustomForegroundColour->Enable(true);
 	}
+
+	pickerSQLMarginBackgroundColour->SetColour(settings->GetSQLMarginBackgroundColour());
 }
 
 void frmOptions::OnChangeSQLUseCustomColour(wxCommandEvent &ev)
@@ -690,6 +693,10 @@ void frmOptions::OnOK(wxCommandEvent &ev)
 		settings->SetSQLBoxColourForeground(pickerSQLForegroundColour->GetColourString());
 	}
 
+    if (pickerSQLMarginBackgroundColour->GetColourString() != settings->GetSQLMarginBackgroundColour())
+        changed = true;
+    settings->SetSQLMarginBackgroundColour(pickerSQLMarginBackgroundColour->GetColourString());
+
     if (pickerSQLColour1->GetColourString() != settings->GetSQLBoxColour(1))
         changed = true;
     settings->SetSQLBoxColour(1, pickerSQLColour1->GetColourString());
diff --git a/pgadmin/include/utils/sysSettings.h b/pgadmin/include/utils/sysSettings.h
index 0a68371..4616d42 100644
--- a/pgadmin/include/utils/sysSettings.h
+++ b/pgadmin/include/utils/sysSettings.h
@@ -155,6 +155,9 @@ public:
     wxString GetSQLBoxColour(int index) const { wxString s; Read(wxString::Format(wxT("ctlSQLBox/Colour%i"), index), &s, getDefaultElementColor(index)); return s; }
 	void SetSQLBoxColour(int index, const wxString &newval) { Write(wxString::Format(wxT("ctlSQLBox/Colour%i"), index), newval); }
 
+    wxString GetSQLMarginBackgroundColour() const { wxString s; Read(wxT("ctlSQLBox/MarginBackgroundColour"), &s, wxT("#dddddd")); return s; }
+	void SetSQLMarginBackgroundColour(const wxString &newval) { Write(wxT("ctlSQLBox/MarginBackgroundColour"), newval); }
+
     // Misc options
     long GetAutoRowCountThreshold() const { long l; Read(wxT("AutoRowCount"), &l, 2000L); return l; }
 	void SetAutoRowCountThreshold(const long newval) { Write(wxT("AutoRowCount"), newval); }
diff --git a/pgadmin/ui/frmOptions.xrc b/pgadmin/ui/frmOptions.xrc
index 43ba9d3..7ddd641 100644
--- a/pgadmin/ui/frmOptions.xrc
+++ b/pgadmin/ui/frmOptions.xrc
@@ -493,84 +493,93 @@
             <size>25,12d</size>
           </object>
 
+          <object class="wxStaticText" name="stSQLMarginBackgroundColour">
+            <label>Margin background</label>
+            <pos>5,65d</pos>
+          </object>
+          <object class="ctlColourPicker" name="pickerSQLMarginBackgroundColour">
+            <pos>80,65d</pos>
+            <size>25,12d</size>
+          </object>
+
           <object class="wxStaticText" name="stSQLColour1">
             <label>Multiline comment</label>
-            <pos>5,75d</pos>
+            <pos>5,95d</pos>
           </object>
           <object class="ctlColourPicker" name="pickerSQLColour1">
-            <pos>80,75d</pos>
+            <pos>80,95d</pos>
             <size>25,12d</size>
           </object>
 
           <object class="wxStaticText" name="stSQLColour2">
             <label>Single line comment</label>
-            <pos>5,90d</pos>
+            <pos>5,110d</pos>
           </object>
           <object class="ctlColourPicker" name="pickerSQLColour2">
-            <pos>80,90d</pos>
+            <pos>80,110d</pos>
             <size>25,12d</size>
           </object>
 
           <object class="wxStaticText" name="stSQLColour3">
             <label>SQL doc</label>
-            <pos>5,105d</pos>
+            <pos>5,125d</pos>
           </object>
           <object class="ctlColourPicker" name="pickerSQLColour3">
-            <pos>80,105d</pos>
+            <pos>80,125d</pos>
             <size>25,12d</size>
           </object>
 
           <object class="wxStaticText" name="stSQLColour4">
             <label>Number</label>
-            <pos>5,120d</pos>
+            <pos>5,140d</pos>
           </object>
           <object class="ctlColourPicker" name="pickerSQLColour4">
-            <pos>80,120d</pos>
+            <pos>80,140d</pos>
             <size>25,12d</size>
           </object>
 
           <object class="wxStaticText" name="stSQLColour5">
             <label>Keyword</label>
-            <pos>5,135d</pos>
+            <pos>5,155d</pos>
           </object>
           <object class="ctlColourPicker" name="pickerSQLColour5">
-            <pos>80,135d</pos>
+            <pos>80,155d</pos>
             <size>25,12d</size>
           </object>
 
           <object class="wxStaticText" name="stSQLColour6">
             <label>Double quoted string</label>
-            <pos>5,150d</pos>
+            <pos>5,170d</pos>
           </object>
           <object class="ctlColourPicker" name="pickerSQLColour6">
-            <pos>80,150d</pos>
+            <pos>80,170d</pos>
             <size>25,12d</size>
           </object>
 
           <object class="wxStaticText" name="stSQLColour7">
             <label>Single quoted string</label>
-            <pos>125,75d</pos>
+            <pos>125,95d</pos>
           </object>
           <object class="ctlColourPicker" name="pickerSQLColour7">
-            <pos>195,75d</pos>
+            <pos>195,95d</pos>
             <size>25,12d</size>
           </object>
 
           <object class="wxStaticText" name="stSQLColour10">
             <label>Operator</label>
-            <pos>125,90d</pos>
+            <pos>125,110d</pos>
           </object>
           <object class="ctlColourPicker" name="pickerSQLColour10">
-            <pos>195,90d</pos>
+            <pos>195,110d</pos>
             <size>25,12d</size>
           </object>
 
           <object class="wxStaticText" name="stSQLColour11">
             <label>Identifier</label>
-            <pos>125,105d</pos>
+            <pos>125,125d</pos>
           </object>
           <object class="ctlColourPicker" name="pickerSQLColour11">
-            <pos>195,105d</pos>
+            <pos>195,125d</pos>
             <size>25,12d</size>
           </object>
           
