feat(options): color-chooser option texts with live hexcodes, default bold

Row 131: the navbarfontcolor dropdown entries now read exactly "Default font
color", "Default background color", "Color 1", "Color 2", "Color 3",
"Other ..." (config.xml options/optionlabels/dropdownoptions renamed from
"Same as default font color" / "Other…"). options.js appends each entry's
chosen hexcode in brackets — presets from their color option fields,
"Other ..." from the custom picker's value (navbarfontcolorcustom) — and the
entry marked data-default="1" stays bold via a real <b> (row 129) plus CSS.
Rendered list example: bold "Default font color [#444444]", "Default
background color [#ffffff]", "Color 1 [#5e1c64]", ..., "Other ... [#444444]".
OPTIONS_JS_TOKEN -> 20261126.10. Verified: render tc=603 (raw option texts
match the list), jsdom 6/6 incl. new pins (exact label texts, hex on
"Other ..." and "Default background color" entries, <b> only on default),
export exit 0. Variants not rebuilt (deferred).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-26 16:49:35 +01:00
commit 1a60918630
3 changed files with 17 additions and 10 deletions

View file

@ -222,19 +222,23 @@
own default value — the element text below IS that default (LimeSurvey
stores it in the DB on theme reset), and the <option data-default="1">
marks it so the options page can show it in BOLD (options.twig CSS +
options.js swatch label). Here the default is "default" ("Same as
default font color"); e.g. when questiontitlebackgroundcolor is later
converted to this pattern, its default can be set to "color1". -->
<navbarfontcolor type="dropdown" category="Colors" width="12" title="Menu item color in header" options="default|defaultbackgroundcolor|color1|color2|color3|other" optionlabels="Same as default font color|Default background color|Color 1|Color 2|Color 3|Other…">default
options.js swatch label). Here the default is "default" ("Default font
color"); e.g. when questiontitlebackgroundcolor is later converted to
this pattern, its default can be set to "color1".
ROW 131: the option TEXTS are exactly "Default font color",
"Default background color", "Color 1", "Color 2", "Color 3",
"Other ..." — options.js appends each entry's live hexcode in brackets
(for "Other ..." the custom color's hex) and bolds the default. -->
<navbarfontcolor type="dropdown" category="Colors" width="12" title="Menu item color in header" options="default|defaultbackgroundcolor|color1|color2|color3|other" optionlabels="Default font color|Default background color|Color 1|Color 2|Color 3|Other ...">default
<dropdownoptions>
<option value="default" data-default="1">Same as default font color</option>
<option value="default" data-default="1">Default font color</option>
<option value="defaultbackgroundcolor">Default background color</option>
<option value="color1">Color 1</option>
<option value="color2">Color 2</option>
<option value="color3">Color 3</option>
<option value="other">Other…</option>
<option value="other">Other ...</option>
</dropdownoptions></navbarfontcolor>
<navbarfontcolorcustom type="colorpicker" category="Colors" width="12" title="Custom menu item color (used when 'Other…' is chosen)" parent="navbarfontcolor">#444444</navbarfontcolorcustom>
<navbarfontcolorcustom type="colorpicker" category="Colors" width="12" title="Custom menu item color (used when 'Other ...' is chosen)" parent="navbarfontcolor">#444444</navbarfontcolorcustom>
<sliderhandlecolor type="colorpicker" category="Colors" width="12" title="Slider handle color" options="on|off" optionlabels="Yes|No">#5e1c64</sliderhandlecolor>
<progressbarbackgroundcolor type="colorpicker" category="Colors" width="12" title="Progress bar background color" options="on|off" optionlabels="Yes|No">#eeeeee</progressbarbackgroundcolor>
<progressbarcolor type="colorpicker" category="Colors" width="12" title="Progress bar color" options="on|off" optionlabels="Yes|No">#5e1c64</progressbarcolor>

View file

@ -778,8 +778,11 @@ var ThemeOptions = function () {
if (!op.data('base-label')) { op.data('base-label', op.text()); }
var base = String(op.data('base-label'));
var pk = presets[mode];
if (pk) {
var c = currentColor(pk);
// row 131: every entry shows its chosen hexcode — the preset colors
// from their option fields, "Other ..." from the custom picker's value
var c = pk ? currentColor(pk)
: (mode === 'other' && customInput.length && /^#[0-9a-fA-F]{3,8}$/.test(String(customInput.val() || '')) ? String(customInput.val()) : '');
if (pk || mode === 'other') {
var label = c ? base + ' [' + c + ']' : base;
if (op.attr('data-default')) {
// row 129: the DEFAULT choice is bold — via a real <b> element

View file

@ -43,7 +43,7 @@
heuristically cached copy (the file has only Last-Modified/ETag, no Cache-Control).
Re-register it with a version token: bump OPTIONS_JS_TOKEN below whenever
options/options.js changes, so every browser fetches the new file once. #}
{% set OPTIONS_JS_TOKEN = '20261126.9' %}
{% set OPTIONS_JS_TOKEN = '20261126.10' %}
{{ unregisterScriptFile(optionsPath ~ '/options.js') }}
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}