Defines a set of design parameters that can be applied to any rquiz function
(singleQuestion, multiQuestions, fillBlanks).
Parameters not recognized by a particular quiz type are silently ignored.
Explicit values passed directly to a quiz function always override theme values.
Usage
rquizTheme(
language = NULL,
shuffle = NULL,
showTipButton = NULL,
showSolutionButton = NULL,
width = NULL,
height = NULL,
center = NULL,
scroll = NULL,
fontFamily = NULL,
fontSize = NULL,
titleFontSize = NULL,
titleAlign = NULL,
titleCol = NULL,
titleBg = NULL,
questionCol = NULL,
questionBg = NULL,
questionFontSize = NULL,
mainCol = NULL,
mainBg = NULL,
optionBg = NULL,
optionLabelBg = NULL,
timerCol = NULL,
navButtonCol = NULL,
navButtonBg = NULL,
tipButtonCol = NULL,
tipButtonBg = NULL,
solutionButtonCol = NULL,
solutionButtonBg = NULL,
tipAreaCol = NULL,
tipAreaBg = NULL,
tipAreaBorder = NULL,
solutionAreaCol = NULL,
solutionAreaBg = NULL,
solutionAreaBorder = NULL,
descriptFontSize = NULL
)Arguments
- language
character; language for UI text (
"en","de","fr","es").- shuffle
logical; whether to randomize options/question order.
logical; whether to show a tip button.
logical; whether to show a solution button.
- width
character; widget width (CSS value).
- height
character; widget height (CSS value).
- center
logical; whether to center the widget.
- scroll
logical; whether to use a fixed height with scrollbar.
- fontFamily
character; font stack for all text.
- fontSize
numeric; base font size in pixels.
- titleFontSize
numeric; title font size in pixels.
- titleAlign
character; title text alignment.
- titleCol
character; title text color.
- titleBg
character; title background color.
- questionCol
character; text color of the question container (singleQuestion, multiQuestions) or description container (fillBlanks). This container also provides visual feedback (green/red) in singleQuestion and fillBlanks.
- questionBg
character; background color of the question/description container (all quiz types).
- questionFontSize
numeric; question font size (singleQuestion, multiQuestions).
- mainCol
character; text color of the main content area and answer options (all quiz types).
- mainBg
character; background color of the main content area (all quiz types).
- optionBg
character; background color of answer option rows/blocks (singleQuestion, multiQuestions). Hover is auto-derived (30% darker).
- optionLabelBg
character; A/B/C label background (singleQuestion only).
- timerCol
character; timer text color (multiQuestions only).
character; navigation/submit button text color (all quiz types).
character; navigation/submit button background color (all quiz types).
character; tip button text color.
character; tip button background color.
character; solution button text color.
character; solution button background color.
- tipAreaCol
character; tip area text color.
- tipAreaBg
character; tip area background color.
- tipAreaBorder
character; tip area border color.
- solutionAreaCol
character; solution area text color.
- solutionAreaBg
character; solution area background color.
- solutionAreaBorder
character; solution area border color.
- descriptFontSize
numeric; description font size (fillBlanks only).
Value
A named list of class "rquizTheme" containing all specified
parameters. Only non-NULL values are included.
See also
singleQuestion, multiQuestions,
fillBlanks — all accept a theme argument.
Examples
# Create a dark theme with shared + quiz-specific settings
dark <- rquizTheme(
fontFamily = "Georgia, serif",
fontSize = 20,
titleCol = "#E0E0E0", titleBg = "#1A1A2E",
questionCol = "#FFFFFF", questionBg = "#16213E",
mainCol = "#E0E0E0", mainBg = "#1A1B2E",
optionBg = "#252540", optionLabelBg = "#0F3460",
navButtonCol = "#FFFFFF", navButtonBg = "#E94560",
tipButtonCol = "#E0E0E0", tipButtonBg = "#2C2C3E",
solutionButtonCol = "#E0E0E0", solutionButtonBg = "#2C2C3E",
tipAreaCol = "#E0E0E0", tipAreaBg = "#1A2A1A",
tipAreaBorder = "#4CAF50",
solutionAreaCol = "#E0E0E0", solutionAreaBg = "#1A1A2E",
solutionAreaBorder = "#5DADE2"
)
# \donttest{
# Apply to singleQuestion:
singleQuestion(
x = list(
question = "Which ocean is the largest?",
options = c("Atlantic", "Indian", "Pacific", "Arctic"),
answer = 3
),
theme = dark, title = "Geography Quiz"
)
# Apply to multiQuestions (uses mainCol, mainBg, navButtonBg, etc.):
multiQuestions(
x = list(
q1 = list(
question = "What is the capital of Japan?",
options = c("Seoul", "Tokyo", "Beijing"),
answer = 2
),
q2 = list(
question = "Which river is the longest?",
options = c("Amazon", "Nile", "Yangtze"),
answer = 2
)
),
theme = dark, title = "Geography Quiz"
)
# Apply to fillBlanks:
fillBlanks(
x = list(
cloze = "The $$!Nile!$$ is the longest river in $$!Africa!$$."
),
theme = dark, title = "Geography Quiz"
)
# Explicit values override the theme:
singleQuestion(
x = list(
question = "Which ocean is the largest?",
options = c("Atlantic", "Indian", "Pacific", "Arctic"),
answer = 3
),
theme = dark, titleBg = "#FF0000"
)
# }
