Customize Terminal or Edit Window in J-GTK

To customize an Edit or Term window for the Gtk IDE:

  1. Using the files ~addons/gui/gtk/config/term.xml and ~addons/gui/gtk/config/edit.xml as templates, create new files in ~config/ with the desired name (note that the default "template" files are likely to move to ~addons/ide/gtk/config eventually)
  2. edit the new xml files so that the "id" property of the "style-scheme" tag matches the file name.
  3. Add color definitions as desired and change the colors used for each defined J element. See Style Scheme Definition Reference (or following) for the full gtksourceview reference for style schemes. For a long list of named colors, look here. Basic colors like red, green, and blue need not be defined but the names must be preceded by "#" when used.

  4. Use Edit|Configure|Gtk Ide to open ~config/gtkide.cfg and edit the EditScheme and/or TermScheme nouns to reflect the name of your new custom style scheme file.

illustrateOpeningGtkIdeToEditTermSetting.png

Example Customization: Terminal with Dark Background and Light Foreground

A file ("termDarkBackground.xml" in this example) with the following information should be saved in your "~config" area (e.g. "/Users/[your ID]/j64-701/config" in Windows 7). This change requires a re-start of your J session to take effect.

<?xml version="1.0" encoding="UTF-8"?>
<style-scheme id="termDarkBackground" _name="term (syntax highlights)" version="1.0">

  <!-- Palette -->
  <color name="blue"             value="#0000FF"/>
  <color name="light-blue"       value="#4444FF"/>
  <color name="papaya"           value="#FFEFD5"/>
  <color name="pink"             value="#FFC0CB"/>
  <color name="high"             value="#E5E5E5"/>
  <color name="bordeaux"         value="#A52A2A"/>
  <color name="cyan"             value="#008A8C"/>
  <color name="cornsilk"         value="#fff8dc"/>
  <color name="gray"             value="#888888"/>
  <color name="green"            value="#009900"/>
  <color name="green-blue"       value="#009966"/>
  <color name="light-green"      value="#DDFCDE"/>
  <color name="light-yellow"     value="#FCFCDD"/>
  <color name="light-gray"       value="#F5F5F5"/>
  <color name="navy"             value="#000080"/>
  <color name="dark-orange"      value="#DD9900"/>
  <color name="darker-red"       value="#DD4444"/>
  <color name="purple"           value="#A020F0"/>
  <color name="violet"           value="#6A5ACD"/>
  <color name="dark-blue"        value="#0057AE"/>
  <color name="dark-red"         value="#800000"/>
  <color name="dark-green"       value="#008000"/>
  <color name="brown"            value="#B07E00"/>

  <style name="text"              foreground="light-yellow" background="navy"/>
  <style name="selection"         foreground="light-gray" background="dark-red"/>
  <style name="current-line"      background="blue"/>

  <!-- Bracket Matching -->
  <style name="bracket-match"     bold="true"/>
  <style name="bracket-mismatch"  background="#red" bold="true"/>

  <!-- Search Matching -->
  <style name="search-match"      background="#yellow"/>

  <!-- Comments -->
  <style name="def:comment"       foreground="gray" italic="true" bold="false"/>

  <!-- Constants -->
  <style name="def:string"        foreground="light-yellow"/>

  <!-- Others -->
  <style name="def:note"          foreground="#BF0303" background="#F7E7E7" bold="true" italic="false"/>
  <style name="def:error"         foreground="pink" underline="true"/>
  <style name="def:underlined"    underline="true"/>

  <!-- J Language specific styles -->
  <style name="j:adverb"      foreground="#yellow"/>
  <style name="j:comment"     use-style="def:comment"/>
  <style name="j:conjunction" foreground="#orange"/>
  <style name="j:control"     foreground="light-gray"/>
  <style name="j:error"       foreground="pink"/>
  <style name="j:exparg"      foreground="light-green" italic="true" />
  <style name="j:global"      foreground="pink"/>
  <style name="j:local"       foreground="violet"/>
  <style name="j:noun"        foreground="cornsilk" bold="true"/>
  <style name="j:noundef"     foreground="cyan"/>
  <style name="j:number"      foreground="papaya"/>
  <style name="j:parens"      foreground="#white"/>
  <style name="j:primitive"   foreground="cyan"/>
  <style name="j:string"      use-style="def:string"/>
  <style name="j:verb"        foreground="light-green"/>

</style-scheme>

Scheme Definition Reference

Reference to the GtkSourceView style scheme definition file format.

Overview

The toplevel tag in a style scheme file is <style-scheme>. It has the following attributes:

id (mandatory)

Identifier for the style scheme. This is must be unique among style schemes.

name (mandatory)

Name of the style scheme. This is the name of the scheme to display to user, e.g. in a preferences dialog.

_name

This is the same as name attribute, except it will be translated. name and _name may not be used simultaneously.

parent-scheme (optional)

Style schemes may have parent schemes: all styles but those specified in the scheme will be taken from the parent scheme. In this way a scheme may be customized without copying all its content.

version (mandatory)

Style scheme format identifier. At the moment it must be "1.0".

style-scheme tag may contain the following tags:

author

Name of the style scheme author.

description

Description of the style scheme.

_description

Same as description except it will be localized.

color tags

These define color names to be used in style tags. It has two attributes: name and value. value is the hexadecimal color specification like "#000000" or named color understood by Gdk prefixed with "#", e.g. "#beige".

style tags

See below for their format description.

Each style tag describes a single element of style scheme (it corresponds to #GtkSourceStyle object). It has the following attributes:

name (mandatory)

Name of the style. It can be anything, syntax highlighting uses lang-id:style-id, and there are few special styles which are used to control general appearance of the text. Style scheme may contain other names to be used in an application. For instance, it may define color to highlight compilation errors in a build log or a color for bookmarks.

foreground

Foreground color. It may be name defined in one of color tags, or value in hexadecimal format, e.g. "#000000", or symbolic name understood by Gdk, prefixed with "#", e.g. "#magenta" or "#darkred".

background

Background color.

italic

"true" or "false"

bold

"true" or "false"

underline

"true" or "false"

strikethrough

"true" or "false"

The following are names of styles which control #GtkSourceView appearance:

text

Default style of text.

selection

Style of selected text.

selection-unfocused

Style of selected text when the widget doesn't have input focus.

cursor

Text cursor style. Only foreground attribute is used for this style

secondary-cursor

Secondary cursor style (used in bidi text). Only foreground attribute is used for this style. If this is not set while "cursor" is, then a color between text background and cursor colors is chosen, so it is enough to use "cursor" style only.

current-line

Current line style. Only background attribute is used

line-numbers

Text and background colors for the left margin, on which line numbers are drawn

bracket-match

Style to use for matching brackets.

bracket-mismatch

Style to use for mismatching brackets.

DevonMcCormick/GTK/CustomizeTermOrEditWindow (last edited 2011-12-12 20:37:24 by DevonMcCormick)