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

View file

@ -754,6 +754,10 @@ var ThemeOptions = function () {
// "Default background color" is the SECOND choice, right after "Same as
// default font color".
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 currentColor = function (key) {
var f = globalForm.find('#simple_edit_options_' + key);
@ -814,7 +818,8 @@ var ThemeOptions = function () {
chip.attr('title', mode + (c ? ' [' + c + ']' : ''));
chip.attr('aria-label', chip.attr('title'));
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 () {