<styleDefinition>
<styleDefinition> is a General Operator
component that allows the user to define custom styles for an individual document. Default styleNumbers, used in Graphical Components, are numbered to . Additional styleNumbers are defined with a <styleDefinition> component.
These new styles are assigned unique numbers that can be used locally in that document.
Attributes and Properties
Attributes for <styleDefinition>
Other (35)
backgroundColortext. Background color (light mode).
backgroundColorDarkModetext. Background color (dark mode).
backgroundColorWordtext. Human-readable name of the background color (light mode).
backgroundColorWordDarkModetext. Human-readable name of the background color (dark mode).
fillColortext. Fill color used inside closed shapes (light mode).
fillColorDarkModetext. Fill color used inside closed shapes (dark mode).
fillColorWordtext. Human-readable name of the fill color (light mode).
fillColorWordDarkModetext. Human-readable name of the fill color (dark mode).
fillOpacitynumber. Opacity of fills, 0 to 1.
highContrastColortext. High-contrast accent color (light mode).
highContrastColorDarkModetext. High-contrast accent color (dark mode).
highContrastColorWordtext. Human-readable name of the high-contrast accent color (light mode).
highContrastColorWordDarkModetext. Human-readable name of the high-contrast accent color (dark mode).
lineColortext. Color used for line strokes (light mode).
lineColorDarkModetext. Color used for line strokes (dark mode).
lineColorWordtext. Human-readable name of the line color (light mode).
lineColorWordDarkModetext. Human-readable name of the line color (dark mode).
lineOpacitynumber. Opacity of line strokes, 0 to 1.
lineStylekeyword. Stroke style for lines.
| Value | Description |
|---|---|
solid | Continuous, unbroken stroke. |
dashed | Stroke composed of evenly-spaced dashes. |
dotted | Stroke composed of evenly-spaced dots. |
lineStyleWordtext. Human-readable name of the line style.
lineWidthnumber. Stroke width for lines, in pixels.
lineWidthWordtext. Human-readable name of the line width.
markerColortext. Color used for markers/points (light mode).
markerColorDarkModetext. Color used for markers/points (dark mode).
markerColorWordtext. Human-readable name of the marker color (light mode).
markerColorWordDarkModetext. Human-readable name of the marker color (dark mode).
markerFilledboolean. Whether the marker is rendered filled (true) or open (false). Has no effect when markerStyle is cross or plus, which have no interior.
markerOpacitynumber. Opacity of markers/points, 0 to 1.
markerSizenumber. Marker size in pixels.
markerStylekeyword. Marker shape.
| Value | Description |
|---|---|
circle | Circular marker. |
square | Square marker. |
triangle | Triangular marker pointing up (alias for "triangleUp"). |
triangleUp | Triangular marker pointing up. |
triangleDown | Triangular marker pointing down. |
triangleLeft | Triangular marker pointing left. |
triangleRight | Triangular marker pointing right. |
diamond | Diamond-shaped marker. |
cross | Cross-shaped marker (×). |
plus | Plus-shaped marker (+). |
markerStyleWordtext. Human-readable name of the marker style.
textColortext. Text color (light mode).
textColorDarkModetext. Text color (dark mode).
textColorWordtext. Human-readable name of the text color (light mode).
textColorWordDarkModetext. Human-readable name of the text color (dark mode).
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. Index identifying which style this definition applies to.
Properties for <styleDefinition name="s">
Other (4)
$s.disabledboolean. Whether this component is disabled and cannot be interacted with.
$s.fixedboolean. Whether this component's value is fixed and cannot be modified.
$s.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
Common to all components (3)
$s.doenetMLtext. The DoenetML source code that produced this component.
$s.hideboolean. Whether to hide this component from the rendered output.
$s.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
Examples
Example: Defining a custom style
In this example, a custom style has been created and assigned a styleNumber of . The custom
style is an adaptation of the default “red” styleNumber of , generating a thicker line and a round rather than a square point. The
attributes ending in Word define the way doenet will render the style descriptions in text references when the styleDescription or
styleDescriptionWithNoun properties are used.