# Theme Editor

Theme is a framework that handles background image, text color, or both at once.
Theme Editor is able to edit the theme.
Multiple tabs are for settings.
The change is reflected in the running Tera Term to push [OK] button, and The change discarded to [Cancel] button.

preview/file tab
  Temporary theme settings(preview), loading and saveing theme files.
Background tab
  BG(Backgroud) related settings.
Background alpha tab
  Transparency of the background image and text background color.
color tab
  Settings related to the text color.

About theme file

## TODO

- Adding BGSPIPath (Specify Susie Plugin folder to load images) setting GUI.

## preview/file tab

preview
Temporarily set (preview), undo a theme.

[preview]
  Temporarily set (preview) theme.
[undo]
  Undo changed theme before opening the dialog

file
Load a theme from a theme file and save theme.

[load]
  Load theme file.
[save]
  Export theme to a file.
  Export a BG theme, a Color theme, or both.

## Background tab(Background theme)

### background

Background images are merged from the bottom up.
See Overview of background.

Simple color plane
  Alphablend with a single color.
  For example, if you want to slightly darker the blended image background image and desktop wallpaper, Alphablend black with half value(128).
  Color
    Plane color
  alpha
    Alpha blend value
Background Image
  Background image.
  Some image files support per-pixel alpha values.
  Image file name
    bmp, png, gif, jpg etc
    32-bit bmp and transparent png has 8-bit alpha channel.
    Transparent gif file treat one color as transparent.
  Pattern
    How to draw background images.
    - stretch
    - tile
    - center
    - fit_withh
    - fit_height
    - autofit
    - autofill
    TODO check details and write them.
  Color
    If there are areas where the background image is not drawn, the area will be painted with this color.
    If there are transparent areas in the image and the Windows wallpaper image is not blended, the area will be patinted with this color too.
  alpha
    Alpha blend value with desktop wallpaper image
    Setting values from transparent to opaque
desktop wallpaper image
  Windows Wallpaper Images

## Transparency for background image and text background color

Transparency of normal text background color
  Transparency of background image and normal text background color
  Setting values from transparent to opaque
  (1) in the image
transparency of reverse text background color
  Transparency of background image and reverse text background color
  Setting values from transparent to opaque
  (2) in the image
Transparency of other text background colors
  transparency of Background image and other text background colors
  Setting values from transparent to opaque
  (3) in the image

When 1 and 3 are transparent, It will be the same as Tera Term 4.

## color tab(color theme)

The color theme sets colors overriding default colors.
Default colors are set in TERATERM.INI.
Colors not set in the color theme ini file will be the default colors.

On this tab, you can configure following settings

- Color settings
- Restore default colors

Select a color in the list and right-clicking (or double-clicking) on it to change color.

commctrl color picker is used now.
(TODO change color picker in Tera Term)

Example of displaying the set color

    wget https://osdn.net/projects/ttssh2/scm/svn/blobs/head/trunk/tests/256colors2.pl?export=raw -O - | perl
    wget https://osdn.net/projects/ttssh2/scm/svn/blobs/head/trunk/tests/colortable16.sh?export=raw -O - | sh
    wget https://osdn.net/projects/ttssh2/scm/svn/blobs/head/trunk/tests/color-sgr-decscnm.pl?export=raw -O - | perl

[default]
  Set default color

## Background Theme Overview

The background image is created as follows.

## Color setting Overview

When Tera Term 5 alpha version

    +------------+          +-----------------------------------+         +---------+        +----------+
    |TERATERM.INI| read     |Tera Term                          |         |Theme    |        |Theme File|
    |            | (Startup)| +---------+          +----------+ |(launch) |Editor   |  Save  | INI      |
    | Default    +------------>         | Startup  |          +----------->         +------->+          |
    |  Colors    |          | | Default +----------> Draw     | |         |         |        | Colors   |
    |            <------------+  Colors | Load     |  Colors  <-----------+         +<-------+          |
    |            |  Write   | |         | Default  |          | |   OK    |         |  Load  |          |
    |            |          | +---------+          +----------+ |         |         |        |          |
    +------------+          +-----------------------------------+         +---------+        +----------+

- Tera Term default colors are read from TERATERM.INI
  Drawing colors will be the default color.
  If themefile is loaded at startup and it contains a color theme, Drawing colors will be colors in theme.
- Load or edit the color in the Theme Editor and press "ok" button to change drawinge colors.
- Saving to TERATERM.INI saves default colors.
- Cannot copy drawing color to default colors.

## About default colors

Default colors and fonts can be set with the following keywords in TERATERM.INI

    | Attr \ ini    | font on/off       | color on/off           | color(R,G,B,R,G,B) |
    |---------------|-------------------|------------------------|--------------------|
    | Normal        | -                 | -                      | VTColor            |
    | Bold          | EnableBold        | EnableBoldAttrColor    | VTBoldColor        |
    | Blink         | -                 | EnableBlinkAttrColor   | VTBlinkColor       |
    | Reverse       | -                 | EnableReverseAttrColor | VTReverseColor     |
    | URL Underline | URLUnderline      | EnableURLColor         | URLColor           |
    | Underline     | UnderlineAttrFont | UnderlineAttrColor     | VTUnderlineColor   |