feat(options): show the default choice of a color-chooser in bold (data-default marker)

The 5 named color choices were already in the requested order (row 125):
Default font color | Default background color | Color 1 | Color 2 | Color 3
('Other…' stays as the 6th dropdown entry that opens the custom picker).

New: the option's default choice is now visually marked. config.xml marks
the default <option data-default="1"> of every color-chooser dropdown
(navbarfontcolor + the five <el>textcolor dropdowns); options.twig's inline
<style> renders those options bold (select option[data-default="1"]) and
options.js adds .is-default (bold) to the matching swatch label, reading the
default from the DOM so any future chooser gets it automatically. For
navbarfontcolor the default is 'default' = 'Same as default font color'.
OPTIONS_JS_TOKEN -> 20261126.8. Verified: render tc=588 (dropdown order
default,defaultbackgroundcolor,color1,color2,color3,other with
data-default on 'default'; served as options.js?v=20261126.8), jsdom 6/6
incl. 4 new row-126 pins, export_public.sh exit 0. No view changes, live
survey unaffected. 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 15:50:28 +01:00
commit 6300beaa88
3 changed files with 29 additions and 12 deletions

View file

@ -218,14 +218,16 @@
navbarfontcolorcustom is rendered VISIBLE but grayed out (disabled) navbarfontcolorcustom is rendered VISIBLE but grayed out (disabled)
unless mode "other" (data-show-if-mode="disable" in options.twig) and unless mode "other" (data-show-if-mode="disable" in options.twig) and
keeps its value across saves (data-keep-value in options.js). keeps its value across saves (data-keep-value in options.js).
PER-OPTION DEFAULT (row 125): every color-chooser dropdown can pick its PER-OPTION DEFAULT (row 125/126): every color-chooser dropdown can pick its
own default value — the element text below IS that default (LimeSurvey own default value — the element text below IS that default (LimeSurvey
stores it in the DB on theme reset). Here the default is "default" stores it in the DB on theme reset), and the <option data-default="1">
("Same as default font color"); e.g. when questiontitlebackgroundcolor marks it so the options page can show it in BOLD (options.twig CSS +
is later converted to this pattern, its default can be set to "color1". --> 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 <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
<dropdownoptions> <dropdownoptions>
<option value="default">Same as default font color</option> <option value="default" data-default="1">Same as default font color</option>
<option value="defaultbackgroundcolor">Default background color</option> <option value="defaultbackgroundcolor">Default background color</option>
<option value="color1">Color 1</option> <option value="color1">Color 1</option>
<option value="color2">Color 2</option> <option value="color2">Color 2</option>
@ -341,7 +343,7 @@
<questiontitlefont type="fontselect" category="Questions" width="4" title="Font for question titles">base</questiontitlefont> <questiontitlefont type="fontselect" category="Questions" width="4" title="Font for question titles">base</questiontitlefont>
<questiontitletextcolor type="dropdown" category="Questions" width="12" title="Text color for question titles" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default <questiontitletextcolor type="dropdown" category="Questions" width="12" title="Text color for question titles" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default
<dropdownoptions> <dropdownoptions>
<option value="default">Default font color</option> <option value="default" data-default="1">Default font color</option>
<option value="primary">Primary color</option> <option value="primary">Primary color</option>
<option value="secondary">Secondary color</option> <option value="secondary">Secondary color</option>
<option value="other">Other…</option> <option value="other">Other…</option>
@ -350,7 +352,7 @@
<answersfont type="fontselect" category="Questions" width="4" title="Font for answers and help texts">base</answersfont> <answersfont type="fontselect" category="Questions" width="4" title="Font for answers and help texts">base</answersfont>
<answerstextcolor type="dropdown" category="Questions" width="12" title="Text color for answers and help texts" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default <answerstextcolor type="dropdown" category="Questions" width="12" title="Text color for answers and help texts" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default
<dropdownoptions> <dropdownoptions>
<option value="default">Default font color</option> <option value="default" data-default="1">Default font color</option>
<option value="primary">Primary color</option> <option value="primary">Primary color</option>
<option value="secondary">Secondary color</option> <option value="secondary">Secondary color</option>
<option value="other">Other…</option> <option value="other">Other…</option>
@ -359,7 +361,7 @@
<grouptitlefont type="fontselect" category="Questions" width="4" title="Font for group titles">base</grouptitlefont> <grouptitlefont type="fontselect" category="Questions" width="4" title="Font for group titles">base</grouptitlefont>
<grouptitletextcolor type="dropdown" category="Questions" width="12" title="Text color for group titles" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default <grouptitletextcolor type="dropdown" category="Questions" width="12" title="Text color for group titles" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default
<dropdownoptions> <dropdownoptions>
<option value="default">Default font color</option> <option value="default" data-default="1">Default font color</option>
<option value="primary">Primary color</option> <option value="primary">Primary color</option>
<option value="secondary">Secondary color</option> <option value="secondary">Secondary color</option>
<option value="other">Other…</option> <option value="other">Other…</option>
@ -368,7 +370,7 @@
<groupdescriptionfont type="fontselect" category="Questions" width="4" title="Font for group descriptions">base</groupdescriptionfont> <groupdescriptionfont type="fontselect" category="Questions" width="4" title="Font for group descriptions">base</groupdescriptionfont>
<groupdescriptiontextcolor type="dropdown" category="Questions" width="12" title="Text color for group descriptions" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default <groupdescriptiontextcolor type="dropdown" category="Questions" width="12" title="Text color for group descriptions" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default
<dropdownoptions> <dropdownoptions>
<option value="default">Default font color</option> <option value="default" data-default="1">Default font color</option>
<option value="primary">Primary color</option> <option value="primary">Primary color</option>
<option value="secondary">Secondary color</option> <option value="secondary">Secondary color</option>
<option value="other">Other…</option> <option value="other">Other…</option>
@ -377,7 +379,7 @@
<buttonsfont type="fontselect" category="Questions" width="4" title="Font for the buttons (Previous/Next/Submit)">base</buttonsfont> <buttonsfont type="fontselect" category="Questions" width="4" title="Font for the buttons (Previous/Next/Submit)">base</buttonsfont>
<buttonstextcolor type="dropdown" category="Questions" width="12" title="Text color for the buttons (Previous/Next/Submit)" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default <buttonstextcolor type="dropdown" category="Questions" width="12" title="Text color for the buttons (Previous/Next/Submit)" options="default|primary|secondary|other" optionlabels="Default font color|Primary color|Secondary color|Other…">default
<dropdownoptions> <dropdownoptions>
<option value="default">Default font color</option> <option value="default" data-default="1">Default font color</option>
<option value="primary">Primary color</option> <option value="primary">Primary color</option>
<option value="secondary">Secondary color</option> <option value="secondary">Secondary color</option>
<option value="other">Other…</option> <option value="other">Other…</option>

View file

@ -754,6 +754,10 @@ var ThemeOptions = function () {
// "Default background color" is the SECOND choice, right after "Same as // "Default background color" is the SECOND choice, right after "Same as
// default font color". // default font color".
var presets = { 'default': 'fontcolor', 'defaultbackgroundcolor': 'defaultbackgroundcolor', 'color1': 'primarycolor', 'color2': 'secondarycolor', 'color3': 'tertiarycolor' }; var presets = { 'default': 'fontcolor', 'defaultbackgroundcolor': 'defaultbackgroundcolor', 'color1': 'primarycolor', 'color2': 'secondarycolor', 'color3': 'tertiarycolor' };
// row 126: the option's DEFAULT choice — the config.xml <option data-default="1">
// (same value as the <default> element text). Shown bold in the dropdown by
// CSS (select option[data-default="1"]) and on the swatch label (is-default).
var defaultMode = String(sel.find('option[data-default="1"]').first().attr('value') || '');
var customInput = globalForm.find('input[name="navbarfontcolorcustom"]'); var customInput = globalForm.find('input[name="navbarfontcolorcustom"]');
var currentColor = function (key) { var currentColor = function (key) {
var f = globalForm.find('#simple_edit_options_' + key); var f = globalForm.find('#simple_edit_options_' + key);
@ -814,7 +818,8 @@ var ThemeOptions = function () {
chip.attr('title', mode + (c ? ' [' + c + ']' : '')); chip.attr('title', mode + (c ? ' [' + c + ']' : ''));
chip.attr('aria-label', chip.attr('title')); chip.attr('aria-label', chip.attr('title'));
chip.toggleClass('active', String(sel.val()) === mode); chip.toggleClass('active', String(sel.val()) === mode);
chip.siblings('.color-chip-label').first().text(c || ''); chip.siblings('.color-chip-label').first().text(c || '')
.toggleClass('is-default', defaultMode !== '' && mode === defaultMode);
}); });
}; };
var refreshEffective = function () { var refreshEffective = function () {

View file

@ -43,7 +43,7 @@
heuristically cached copy (the file has only Last-Modified/ETag, no Cache-Control). 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 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. #} options/options.js changes, so every browser fetches the new file once. #}
{% set OPTIONS_JS_TOKEN = '20261126.7' %} {% set OPTIONS_JS_TOKEN = '20261126.8' %}
{{ unregisterScriptFile(optionsPath ~ '/options.js') }} {{ unregisterScriptFile(optionsPath ~ '/options.js') }}
{{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }} {{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}
@ -154,6 +154,16 @@
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
/* row 126: the DEFAULT choice of a color-chooser option (the config.xml
<option data-default="1">) is shown in bold — in the dropdown (CSS below)
and on its swatch label (is-default class set by options.js) */
select option[data-default="1"] {
font-weight: 700;
}
.color-chip-label.is-default {
font-weight: 700;
color: #212529;
}
.color-mode-effective { .color-mode-effective {
display: inline-block; display: inline-block;
width: 1.1rem; width: 1.1rem;