From 37e052139f366ddecac7e9a069d20880ac9db82c Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sat, 21 Mar 2015 16:25:13 +0000
Subject: [PATCH] experiment with dark scheme

---
 Fltk/FlGui.cpp     | 21 +++++++++++++++------
 Fltk/inputRange.h  |  6 +++++-
 Fltk/outputRange.h |  6 +++++-
 3 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp
index 96a961a7dd..fd8ed0d7a0 100644
--- a/Fltk/FlGui.cpp
+++ b/Fltk/FlGui.cpp
@@ -253,11 +253,16 @@ FlGui::FlGui(int argc, char **argv)
   if(CTX::instance()->display.size())
     Fl::display(CTX::instance()->display.c_str());
 
-#if 0 // dark scheme... not bad, but needs work
-  Fl::background(110, 110, 110);
-  Fl::background2(140, 140, 140);
-  Fl::foreground(230, 230, 230);
-  //Fl::set_color(FL_SELECTION_COLOR, 50, 50, 0);
+//#define DARK_SCHEME
+#if defined(DARK_SCHEME)
+  Fl::background(50, 50, 50);
+  Fl::background2(145, 145, 145);
+  Fl::foreground(250, 250, 250);
+  for (int i = 0; i < FL_NUM_GRAY; i++) {
+    double min = 0., max = 165.;
+    int d = (int)(min + i * (max - min) / (FL_NUM_GRAY - 1.));
+    Fl::set_color(fl_gray_ramp(i), d, d, d);
+  }
 #endif
 
   // add new box types (dx dy dw dh)
@@ -283,7 +288,7 @@ FlGui::FlGui(int argc, char **argv)
     Fl::scheme(CTX::instance()->guiTheme.c_str());
   Fl_Tooltip::size(FL_NORMAL_SIZE);
   Fl_Tooltip::delay(0.5);
-#if defined(__APPLE__)
+#if defined(__APPLE__) && !defined(DARK_SCHEME)
   Fl_Tooltip::color(FL_LIGHT2);
 #endif
 
@@ -349,6 +354,10 @@ FlGui::FlGui(int argc, char **argv)
   graph[0]->getWindow()->show(argc >0 ? 1 : 0, argv);
   if(graph[0]->getMenuWindow()) graph[0]->getMenuWindow()->show();
 
+#if defined(DARK_SCHEME)
+  Fl::set_color(FL_SELECTION_COLOR, 200, 200, 200);
+#endif
+
   // graphic window should have the initial focus (so we can e.g. directly loop
   // through time steps with the keyboard)
   Fl::focus(graph[0]->gl[0]);
diff --git a/Fltk/inputRange.h b/Fltk/inputRange.h
index 301ab653f7..8425f03d57 100644
--- a/Fltk/inputRange.h
+++ b/Fltk/inputRange.h
@@ -329,7 +329,11 @@ class inputRange : public Fl_Group {
   std::string loop(){ return _loop_val; }
   void graph(const std::string &val){ _set_graph_value(val); }
   std::string graph(){ return _graph_val; }
-  void color(int col){ _input->color(col); }
+  void color(int col)
+  {
+    _input->color(col);
+    _input->textcolor(fl_contrast(FL_FOREGROUND_COLOR, col));
+  }
   int color(){ return _input->color(); }
   Fl_Value_Input *input(){ return _input; }
 };
diff --git a/Fltk/outputRange.h b/Fltk/outputRange.h
index e218492df5..3ef7063e0a 100644
--- a/Fltk/outputRange.h
+++ b/Fltk/outputRange.h
@@ -142,7 +142,11 @@ class outputRange : public Fl_Group {
   }
   void graph(const std::string &val){ _set_graph_value(val); }
   std::string graph(){ return _graph_val; }
-  void color(int col){ _output->color(col); }
+  void color(int col)
+  {
+    _output->color(col);
+    _output->textcolor(fl_contrast(FL_FOREGROUND_COLOR, col));
+  }
 };
 
 #endif
-- 
GitLab