The text element classes Listbox, Textbox, and TextEditor
provide for highlighting selected text. The highlighted color
is added to the selection's background and text color to produce
the highlight. An alpha value is used to determine the intensity
of the highlight.
The applicable Lokasenna text element classes use the GUI color
"elm_fill" and an alpha value of 0.5. These are fixed in code.
While this generally provides satisfactory results there are times
when more fine-tuning may be desired. Hence, dh_Toolkit introduces
the theme color "sel_txt". Themes use this color's alpha to
determine the intensity of the highlight.
There are two ways to adjust the alpha value:
Method 1:
Use the "sel_txt" color's alpha value.
In dh_ThemeDesigner use the "selAlpha" slider on the "dh_Toolkit"
tab to adjust the "sel_txt" alpha value.
Values range from 0 (no highlight) to 10 (full highlight).
This affects all elements that have its "col_sel_text" property
set to "sel_txt" (the default). In dh_ThemeDesigner this
affects the text elements on the "dh_Toolkit" tab and the
"Color uses" listbox in the Tools panel.
The "sel_txt" alpha value can be overridden by using Method 2.
Method 2:
Override the highlighting color's alpha value.
By setting an element's "use_sel_alpha" property to true the
highlighting alpha can be overridden. This is whether using
the "sel_txt" color or any other color.
With the element's "use_sel_alpha" property to true set the
"sel_alpha" property to a value from -1.0 to +1.0.
(More on negative values follows.) The default is 0.5.
This is how it is handled on the "Show" panel (accessed via the
"Show" menu on the Lokasenna tab). That menu also provides
options for changing the panel's background color, the highlight
color, and the value of the alpha.
(When changing the background color dh_ThemeDesigner automatically
selects a corresponding text color.)
By using this method the alpha is adjusted only for the element
for which it is set.
A positive alpha value produces a highlight by lightening
both the background and text. This can produce washed out text
when use with a darker text. Conversely, using a negative alpha value
produces a highlight that darkens the background and text.
Theme design:
It is always wise to choose a background color (elm_bg) and
a text color (elm_txt) with a good constrast, hence legibility.
Then choose a highlight color (sel_txt) and alpha value that
produces good results.
It seems that best compatibility amongst themes
will come from using Case 1, and possibly Case 2.
Case 1: Dark background with light text (standard).
Highlight color should lighten background. Text also gets
lightened. If it is white it will remain white. If
it is off-white it will get lightened which is fine.
Case 2: Light background with dark text.
Highlight color should darken background. Text also gets
darkened. If it is black it will remain black. If
it is very dark it will get darkened which is fine.
Case 3: Medium gray background with dark text.
Will need to use a lightening highlight for text to remain legible.
Not a good choice.
Case 4: Medium gray background with light text.
May need to use a darkening highlight for text to remain legible.
Not a good choice.
Keep in mind that overriding the standard settings may produce
unsatisfactory results with other themes. I use it in dh_ThemeDesigner
for the "Show" Listbox. dh_ThemeDesigner provides for adjusting
its alpha value during run time.