diff --git a/config.xml b/config.xml index d2b87e6..d3689e8 100644 --- a/config.xml +++ b/config.xml @@ -207,25 +207,32 @@ 2026-11-26, row 115): they are mostly NOT one of the default colors, default white #ffffff. --> #ffffff - - default + keeps its value across saves (data-keep-value in options.js). + PER-OPTION DEFAULT (row 125): every color-chooser dropdown can pick its + own default value — the element text below IS that default (LimeSurvey + stores it in the DB on theme reset). 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". --> + default + - - #444444 + #444444 #5e1c64 #eeeeee #5e1c64 diff --git a/options/options.js b/options/options.js index 70b9cdf..9aaf446 100644 --- a/options/options.js +++ b/options/options.js @@ -736,7 +736,7 @@ var ThemeOptions = function () { }; // THEME ADDITION (row 115, working example on navbarfontcolor only): preset-dropdown - // UI for the "Menu item text color" option. + // UI for the "Menu item color in header" option. // - option labels of the navbarfontcolor dropdown get the LIVE hex of the preset // they point at ("Color 1 [#5e1c64]" — values read from the stored options JSON / // the fields' data-inheritvalue, so they also work at survey level with inherit) @@ -749,8 +749,11 @@ var ThemeOptions = function () { var navbarColorModeUI = function () { var sel = globalForm.find('select[name="navbarfontcolor"]'); if (!sel.length) { return; } - // row 124: 5 presets — the 4th named color is now the "Default background color" - var presets = { 'default': 'fontcolor', 'color1': 'primarycolor', 'color2': 'secondarycolor', 'color3': 'tertiarycolor', 'defaultbackgroundcolor': 'defaultbackgroundcolor' }; + // row 124/125: 5 presets, in the SAME order as the dropdown options in + // config.xml (object key order = swatch chip order) — row 125: the + // "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' }; var customInput = globalForm.find('input[name="navbarfontcolorcustom"]'); var currentColor = function (key) { var f = globalForm.find('#simple_edit_options_' + key); @@ -838,8 +841,13 @@ var ThemeOptions = function () { updateAllChildren(); updateVisibilityByParent(); } else if (!sel.val()) { - // no (matching) stored value: fall back to the first option - sel.val('default'); + // no (matching) stored value: fall back to the option's configured + // default (row 125: every color-chooser option can pick its own default + // via the config.xml , stored on theme reset; in the DOM the + // inherited value is data-inheritvalue, else the first non-"inherit" + // dropdown entry is the default choice of the pattern) + var fallback = sel.data('inheritvalue') || sel.find('option').not('[value="inherit"]').first().attr('value'); + if (fallback) { sel.val(fallback); } updateAllChildren(); updateVisibilityByParent(); } diff --git a/options/options.twig b/options/options.twig index fbeedc8..6d936a1 100644 --- a/options/options.twig +++ b/options/options.twig @@ -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.6' %} +{% set OPTIONS_JS_TOKEN = '20261126.7' %} {{ unregisterScriptFile(optionsPath ~ '/options.js') }} {{ registerScriptFile(optionsPath ~ '/options.js?v=' ~ OPTIONS_JS_TOKEN, 'POS_END') }}