diff --git a/pgadmin/ctl/ctlSQLBox.cpp b/pgadmin/ctl/ctlSQLBox.cpp
index e5ac646..bde0363 100644
--- a/pgadmin/ctl/ctlSQLBox.cpp
+++ b/pgadmin/ctl/ctlSQLBox.cpp
@@ -110,6 +110,8 @@ void ctlSQLBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
 		StyleSetFont(i, fntSQLBox);
 	}
 
+	// Margin style
+	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 c9f23ee..5b7dc78 100644
--- a/pgadmin/frm/frmOptions.cpp
+++ b/pgadmin/frm/frmOptions.cpp
@@ -82,6 +82,7 @@
 #define pickerSQLForegroundColour        CTRL_COLOURPICKER("pickerSQLForegroundColour")
 #define stSQLCustomBackgroundColour      CTRL_STATIC("stSQLCustomBackgroundColour") 
 #define stSQLCustomForegroundColour      CTRL_STATIC("stSQLCustomForegroundColour") 
+#define pickerSQLMarginBackgroundColour  CTRL_COLOURPICKER("pickerSQLMarginBackgroundColour")
 
 BEGIN_EVENT_TABLE(frmOptions, pgDialog)
     EVT_MENU(MNU_HELP,                                            frmOptions::OnHelp)
@@ -412,6 +413,8 @@ void frmOptions::UpdateColourControls()
 		pickerSQLForegroundColour->SetColour(settings->GetSQLBoxColourForeground());
 		stSQLCustomForegroundColour->Enable(true);
 	}
+
+	pickerSQLMarginBackgroundColour->SetColour(settings->GetSQLMarginBackgroundColour());
 }
 
 void frmOptions::OnChangeSQLUseCustomColour(wxCommandEvent &ev)
@@ -660,8 +663,8 @@ void frmOptions::OnOK(wxCommandEvent &ev)
     settings->SetFavouritesFile(txtFavouritesFile->GetValue());
     settings->SetMacrosFile(txtMacrosFile->GetValue());
     settings->SetHistoryFile(txtHistoryFile->GetValue());
-	// Change SQL Syntax colours
 
+	// Change SQL Syntax colours
 	if (settings->GetSQLBoxUseSystemBackground() != chkSQLUseSystemBackgroundColour->GetValue())
 	{
 		changed = true;
@@ -692,6 +695,12 @@ void frmOptions::OnOK(wxCommandEvent &ev)
 		settings->SetSQLBoxColourForeground(sColour);
 	}
 
+	colour = pickerSQLMarginBackgroundColour->GetColour();
+	sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
+	if (sColour != settings->GetSQLMarginBackgroundColour())
+		changed = true;
+	settings->SetSQLMarginBackgroundColour(sColour);
+
 	for (int i = 0; i <= 11; ++i)
 	{
 		wxString pickerId = wxString::Format(wxT("pickerSQLColour%i"), i);
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 162423e..917315c 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" name="pickerSQLColour11">
-            <pos>195,105d</pos>
+            <pos>195,125d</pos>
             <size>25,12d</size>
           </object>
           
