[isabelle] Usability for light-on-dark color schemes



There are currently a bunch of elements whose colors are hardcoded to be
black in the Isabelle plugin source code. There is also a patch in
src/Tools/jEdit/patches that sets the default style (style zero, i.e. no
style) in a similar fashion.

A small number of us use light-on-dark color schemes. I even have a
jEdit macro that will set the majority of such a color scheme for you
(ping me if you'd like a copy). To set sane defaults in jEdit and then
have the Isabelle plugin ignore them is a bit inconvenient. For example,
a HOL implication is Markup.DELIMITER, which is hardcoded to black. If
you have a dark background, black on dark is bad.

You can apply the attached patch to an Isabelle 2015 setup, no
modifications to jEdit required. It will use jEdit's text area default
foreground text color instead of Color.BLACK. It will also override
extended style 0 to be the default text foreground color with user's
default font.

For submission into Isabelle proper, the changes to rendering.scala are
fine, but the style(0) override shouldn't make it in to the official
repo. That should be adjusted in
src/Tools/jEdit/patches/extended_styles instead.

It's a pretty trivial modification, but makes lives of cave-dwellers
much happier.

Sincerely,

Rafal Kolanski
diff --git a/src/Tools/jEdit/src/rendering.scala b/src/Tools/jEdit/src/rendering.scala
--- a/src/Tools/jEdit/src/rendering.scala
+++ b/src/Tools/jEdit/src/rendering.scala
@@ -224,6 +224,7 @@
   /* colors */
 
   def color_value(s: String): Color = Color_Value(options.string(s))
+  def jedit_fg_color = jEdit.getColorProperty("view.fgColor")
 
   val outdated_color = color_value("outdated_color")
   val unprocessed_color = color_value("unprocessed_color")
@@ -277,7 +278,6 @@
   val inner_comment_color = color_value("inner_comment_color")
   val dynamic_color = color_value("dynamic_color")
 
-
   /* completion */
 
   def semantic_completion(range: Text.Range): Option[Text.Info[Completion.Semantic]] =
@@ -716,12 +716,12 @@
       Markup.QUASI_KEYWORD -> quasi_keyword_color,
       Markup.IMPROPER -> improper_color,
       Markup.OPERATOR -> operator_color,
-      Markup.STRING -> Color.BLACK,
-      Markup.ALT_STRING -> Color.BLACK,
-      Markup.VERBATIM -> Color.BLACK,
-      Markup.CARTOUCHE -> Color.BLACK,
+      Markup.STRING -> jedit_fg_color,
+      Markup.ALT_STRING -> jedit_fg_color,
+      Markup.VERBATIM -> jedit_fg_color,
+      Markup.CARTOUCHE -> jedit_fg_color,
       Markup.LITERAL -> keyword1_color,
-      Markup.DELIMITER -> Color.BLACK,
+      Markup.DELIMITER -> jedit_fg_color,
       Markup.TFREE -> tfree_color,
       Markup.TVAR -> tvar_color,
       Markup.FREE -> free_color,
@@ -736,7 +736,7 @@
       Markup.ML_KEYWORD1 -> keyword1_color,
       Markup.ML_KEYWORD2 -> keyword2_color,
       Markup.ML_KEYWORD3 -> keyword3_color,
-      Markup.ML_DELIMITER -> Color.BLACK,
+      Markup.ML_DELIMITER -> jedit_fg_color,
       Markup.ML_NUMERAL -> inner_numeral_color,
       Markup.ML_CHAR -> inner_quoted_color,
       Markup.ML_STRING -> inner_quoted_color,
diff --git a/src/Tools/jEdit/src/token_markup.scala b/src/Tools/jEdit/src/token_markup.scala
--- a/src/Tools/jEdit/src/token_markup.scala
+++ b/src/Tools/jEdit/src/token_markup.scala
@@ -115,6 +115,12 @@
     override def extendStyles(styles: Array[SyntaxStyle]): Array[SyntaxStyle] =
     {
       val new_styles = new Array[SyntaxStyle](full_range)
+
+      // override NULL style to be same color as default text, as
+      // it's hardcoded as black into the jEdit isabelle patch at
+      // jEdit-patched/org/gjt/sp/util/SyntaxUtilities.java
+      styles(0) = new SyntaxStyle(jEdit.getColorProperty("view.fgColor"), null, styles(0).getFont)
+
       for (i <- 0 until plain_range) {
         val style = styles(i)
         new_styles(i) = style


This archive was generated by a fusion of Pipermail (Mailman edition) and MHonArc.