changeset 21010:d9f4e4961e09

improved margin and marker colors in the editor * file-editor-tab.cc (update_lexer): caclulate color from background and foreground color of the lexer, borders of markers set to foreground color
author Torsten <ttl@justmail.de>
date Wed, 30 Dec 2015 09:46:05 +0100
parents 9b21039bf63b
children 91a45293b618
files libgui/src/m-editor/file-editor-tab.cc
diffstat 1 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc
+++ b/libgui/src/m-editor/file-editor-tab.cc
@@ -586,17 +586,23 @@
   _edit_area->setCaretForegroundColor (lexer->color (0));
   _edit_area->setIndentationGuidesForegroundColor (lexer->color (0));
 
-  // set margin colors depending on selected background color of the lexer
-  QColor bg = lexer->paper (0), fg;
-  int h, s, v, factor=-1;
-  bg.getHsv (&h,&s,&v);
+  // set some colors depending on selected background color of the lexer
+  QColor bg = lexer->paper (0);
+  QColor fg = lexer->color (0);
+
+  int bh, bs, bv, fh, fs, fv, h, s, v;
+  bg.getHsv (&bh,&bs,&bv);
+  fg.getHsv (&fh,&fs,&fv);
 
-  if (v < 96)
-    factor = 2;
+  // margin colors
+  h = bh;
+  s = bs/2;
+  v = bv + (fv - bv)/8;
+  bg.setHsv (h,s,v);
+  v = bv + (fv - bv)/4;
+  fg.setHsv (h,s,v);
 
-  bg.setHsv (h,s/2,v + factor*40);
-  fg.setHsv (h,s/2,v + (factor+1)*40);
-
+  _edit_area->setMarkerForegroundColor (lexer->color (0));
   _edit_area->setMarginsForegroundColor (lexer->color (0));
   _edit_area->setMarginsBackgroundColor (bg);
   _edit_area->setFoldMarginColors (bg,fg);