feat(options): Questions tab 'Question title and body' section with 6-way color choosers (row 178 plan P2)

config.xml: new section keys questiontitlefont/textcolor(+custom)/fontsize/
fontoptions + legacy fontcolor (col 1), questiontitlebackgroundcolor(+custom)
(col 2), questionbackgroundcolor(+custom) (col 3); old width-12 Prompt-U keys
and plain colorpickers replaced; questiontitlefontweight -> questiontitlefontoptions.
options.twig: title section slots (were prepared in P1), 3 keys join
aColorChooserKeys, OPTIONS_JS_TOKEN 20261129.1. options.js: same 3 keys in its
aColorChooserKeys. Views: choosers resolved via cm() (chooser wins; legacy hex
and primary/secondary modes pass through; legacy picker used when the mode key
is absent); fontoptions mapped to weight/style with legacy fontweight fallback.
build.php: chooser migration list + questiontitle fontweight migration.
All 3 variants rebuilt (defensie legacy hex -> other+custom), example config synced.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-29 14:45:57 +01:00
commit 14eb1c2a99
2 changed files with 214 additions and 92 deletions

View file

@ -21,10 +21,11 @@
headerbackgroundcolor, the progress bar colors and bodybackgroundcolor below
(navbarfontcolor keeps its own inline expression further down). Modes: default|defaultbackgroundcolor|
color1|color2|color3|other, or a raw hex (legacy stored value) which passes
through directly. #}
through directly. Row 180 / plan P2: legacy modes "primary"/"secondary" of the
old 4-way <el>textcolor dropdowns map to color1/color2 as well. #}
{% macro cm(mode, custom, opts) -%}
{%- set m = mode|default('') -%}
{{- m matches '/^#[0-9a-fA-F]{3,8}$/' ? m : (m == 'color1' ? opts.primarycolor|default('') : (m == 'color2' ? opts.secondarycolor|default('') : (m == 'color3' ? opts.tertiarycolor|default('') : (m == 'defaultbackgroundcolor' ? opts.defaultbackgroundcolor|default('') : (m == 'other' ? custom|default('') : opts.fontcolor|default('')))))) -}}
{{- m matches '/^#[0-9a-fA-F]{3,8}$/' ? m : (m == 'color1' or m == 'primary' ? opts.primarycolor|default('') : (m == 'color2' or m == 'secondary' ? opts.secondarycolor|default('') : (m == 'color3' ? opts.tertiarycolor|default('') : (m == 'defaultbackgroundcolor' ? opts.defaultbackgroundcolor|default('') : (m == 'other' ? custom|default('') : opts.fontcolor|default('')))))) -}}
{%- endmacro %}
{% import _self as cmm %}
@ -56,11 +57,25 @@
color: {{ aSurveyInfo.options.fontcolor }};
}
{# Row 180 / plan P2: the question title now uses the color-chooser scheme —
questiontitletextcolor + questiontitletextcolorcustom (text) and
questiontitlebackgroundcolor + questiontitlebackgroundcolorcustom
(background), resolved via cm() (default modes: text "other" per row 178,
background "color1"; legacy stored hex passes through). The CHOOSER wins
when the mode key exists in the stored options; a row from before P2 (no
questiontitletextcolor key) falls back to the legacy plain picker
questiontitlefontcolor. questiontitlefontoptions (normal|bold|italic|
bolditalic) replaces questiontitlefontweight (400|700) — a legacy stored
weight is mapped like the group title/description (row 157). #}
{% set sQTitleFontOptions = aSurveyInfo.options.questiontitlefontoptions|default(aSurveyInfo.options.questiontitlefontweight|default('700') == '700' ? 'bold' : 'normal') %}
{% set sQTitleBackgroundColor = cmm.cm(aSurveyInfo.options.questiontitlebackgroundcolor|default('color1'), aSurveyInfo.options.questiontitlebackgroundcolorcustom|default(''), aSurveyInfo.options) %}
{% set sQTitleTextColor = aSurveyInfo.options.questiontitletextcolor is defined ? cmm.cm(aSurveyInfo.options.questiontitletextcolor, aSurveyInfo.options.questiontitletextcolorcustom|default(''), aSurveyInfo.options) : aSurveyInfo.options.questiontitlefontcolor|default('') %}
.question-title-container {
font-size: {{ aSurveyInfo.options.questiontitlefontsize }};
font-weight: {{ aSurveyInfo.options.questiontitlefontweight }};
background: {{ aSurveyInfo.options.questiontitlebackgroundcolor }};
color: {{ aSurveyInfo.options.questiontitlefontcolor }};
font-weight: {{ sQTitleFontOptions == 'bold' or sQTitleFontOptions == 'bolditalic' ? '700' : '400' }};
font-style: {{ sQTitleFontOptions == 'italic' or sQTitleFontOptions == 'bolditalic' ? 'italic' : 'normal' }};
background: {{ sQTitleBackgroundColor }};
color: {{ sQTitleTextColor }};
}
{# Row 157: group title/description font OPTIONS (config.xml <el>fontoptions:
@ -271,8 +286,12 @@
color: {{ sProgressBarFontColor }};
}
{# Row 180 / plan P2: the question body background is a color chooser now
(questionbackgroundcolor, default mode "defaultbackgroundcolor", +
questionbackgroundcolorcustom for "other"); a legacy stored hex passes
through cm() directly. #}
.question-container, #welcome-container {
background: {{ aSurveyInfo.options.questionbackgroundcolor }};
background: {{ cmm.cm(aSurveyInfo.options.questionbackgroundcolor|default('defaultbackgroundcolor'), aSurveyInfo.options.questionbackgroundcolorcustom|default(''), aSurveyInfo.options) }};
}
.question-help-container, .question-valid-container {
@ -289,8 +308,8 @@
}
.bg-primary{
background-color: {{ aSurveyInfo.options.questiontitlebackgroundcolor }};
color: {{ aSurveyInfo.options.questiontitlefontcolor }};
background-color: {{ sQTitleBackgroundColor }};
color: {{ sQTitleTextColor }};
}
.btn-primary:hover, .btn-primary:focus {

View file

@ -23,11 +23,16 @@
"questiontitlefont", type fontselect). "base" = same as the base font: no extra
class, the element inherits the body font. #}
{% set sQuestionTitleFont = aSurveyInfo.options.questiontitlefont|default('base') %}
{# Prompt U: per-element text color — mode default -> fontcolor, primary ->
primarycolor, secondary -> secondarycolor, other -> questiontitletextcolorcustom.
Emitted as an inline style on the element below. #}
{% set sQuestionTitleTextColorMode = aSurveyInfo.options.questiontitletextcolor|default('default') %}
{% set sQuestionTitleTextColor = sQuestionTitleTextColorMode == 'primary' ? aSurveyInfo.options.primarycolor|default('') : (sQuestionTitleTextColorMode == 'secondary' ? aSurveyInfo.options.secondarycolor|default('') : (sQuestionTitleTextColorMode == 'other' ? aSurveyInfo.options.questiontitletextcolorcustom|default('') : aSurveyInfo.options.fontcolor|default(''))) %}
{# Prompt U / row 180 plan P2: per-element text color — now the 6-way color-chooser
scheme (default|defaultbackgroundcolor|color1|color2|color3|other) with
questiontitletextcolorcustom for "other". Legacy modes of the old 4-way dropdown
(primary|secondary) map to color1/color2, a raw hex passes through. When the
mode key is absent entirely (row from before Prompt U) no inline style is
emitted here — custom_header.twig then falls back to the legacy plain picker
questiontitlefontcolor. Emitted as an inline style on the element below. #}
{% set sQuestionTitleTextColorMode = aSurveyInfo.options.questiontitletextcolor is defined ? aSurveyInfo.options.questiontitletextcolor : '' %}
{% set oQ = aSurveyInfo.options %}
{% set sQuestionTitleTextColor = sQuestionTitleTextColorMode == '' ? '' : (sQuestionTitleTextColorMode matches '/^#[0-9a-fA-F]{3,8}$/' ? sQuestionTitleTextColorMode : (sQuestionTitleTextColorMode == 'color1' or sQuestionTitleTextColorMode == 'primary' ? oQ.primarycolor|default('') : (sQuestionTitleTextColorMode == 'color2' or sQuestionTitleTextColorMode == 'secondary' ? oQ.secondarycolor|default('') : (sQuestionTitleTextColorMode == 'color3' ? oQ.tertiarycolor|default('') : (sQuestionTitleTextColorMode == 'defaultbackgroundcolor' ? oQ.defaultbackgroundcolor|default('') : (sQuestionTitleTextColorMode == 'other' ? oQ.questiontitletextcolorcustom|default('') : oQ.fontcolor|default(''))))))) %}
<!-- Question text -->
<div class="{{ aSurveyInfo.class.questiontitlecontainer }} col-12 {% if sQuestionTitleFont != 'base' %}font-{{ sQuestionTitleFont }}{% endif %}" {% if sQuestionTitleTextColor != '' %}style="color: {{ sQuestionTitleTextColor }};"{% endif %} {{ aSurveyInfo.attr.questiontitlecontainer }} >