Tutorial: reusable colour settings
What you will learn
- Add settings to a scoreboard.
- Use settings as
{{ setting:... }}placeholders. - Change a colour once and update the whole board.
Colour schemes are a common request: a board is published in red, blue, green and yellow variants, each as a separate file. Settings let you keep one file and change the palette in one place.
Step 1: a board with hard-coded colours
Create plugins/FeatherBoard/scoreboards/tutorial.yml:
title:
frames:
- '&e&lCyrium Prison'
interval: 20
lines:
header:
frames:
- '&7---------------'
interval: 100
balance-label:
frames:
- '&e&lBalance &7:'
interval: 100
balance:
frames:
- '&8&l%vault_eco_balance_formatted%'
interval: 2
spacer1:
frames: []
interval: 100
multiplier-label:
frames:
- '&e&lMultiplier &7:'
interval: 100
multiplier:
frames:
- '&8&l%autosell_multiplier%'
interval: 2
spacer2:
frames: []
interval: 100
online:
frames:
- '&8&l%server_online% &7online players'
interval: 10
footer:
frames:
- '&7---------------'
interval: 100If you want to change the yellow, dark grey or light grey, you have to edit every line. That is where settings help.
Step 2: add settings
Add a settings section at the top of the file:
settings:
color-light: '&7'
color-dark: '&8'
color-subtitle: '&e'Step 3: use the settings
Replace the colours with {{ setting:key }}:
settings:
color-light: '&7'
color-dark: '&8'
color-subtitle: '&e'
title:
frames:
- '{{ setting:color-subtitle }}&lCyrium Prison'
interval: 20
lines:
header:
frames:
- '{{ setting:color-light }}---------------'
interval: 100
balance-label:
frames:
- '{{ setting:color-subtitle }}&lBalance {{ setting:color-light }}:'
interval: 100
balance:
frames:
- '{{ setting:color-dark }}&l%vault_eco_balance_formatted%'
interval: 2
spacer1:
frames: []
interval: 100
multiplier-label:
frames:
- '{{ setting:color-subtitle }}&lMultiplier {{ setting:color-light }}:'
interval: 100
multiplier:
frames:
- '{{ setting:color-dark }}&l%autosell_multiplier%'
interval: 2
spacer2:
frames: []
interval: 100
online:
frames:
- '{{ setting:color-dark }}&l%server_online% {{ setting:color-light }}&lonline players'
interval: 10
footer:
frames:
- '{{ setting:color-light }}---------------'
interval: 100Reload the board:
/fb reload tutorialThe board looks the same, but every colour now comes from three settings.
Step 4: change a colour live
Use /fb editsetting to change a setting and save it to the board:
/fb editsetting tutorial color-subtitle &a
/fb editsetting tutorial color-light &f
/fb editsetting tutorial color-dark &7The board reloads immediately. This is the fastest way to preview a palette before editing the file.
Use a theme setting
If you want to switch between complete palettes, keep reading the colour schemes tutorial. It adds a color-scheme setting and a small script that fills the individual colours.
Common mistakes
The setting placeholder is visible
Use {{ setting:color-light }} with double braces and the setting: prefix. {setting:...}, $setting_color-light$ and %setting_color-light% are not valid.
The colour does not apply
Colour codes reset formatting. Put the setting first and the formatting code after it, as in {{ setting:color-subtitle }}&lBalance.
A setting is missing after a reload
Check the spelling of the key. Settings are case-sensitive and must be scalar values (strings, numbers or booleans) to be usable as placeholders.
