Register default values that the HUD uses when no user configuration exists.
Hooks.once("stylish-action-hud.apiReady", (api) => {
api.registerDefaultAttributes("my-system", [
{
path: "system.health",
label: "HP",
color: "#e61c34",
style: "bar",
},
{
path: "system.mana",
label: "MP",
color: "#3498db",
style: "bar",
},
{
path: "system.stamina",
label: "SP",
color: "#2ecc71",
style: "bar",
},
], {
priority: 0,
mode: "replace", // "replace", "append", or "prepend"
source: "my-module",
});
});
Define the default action menu button layout:
api.registerDefaultLayout("my-system", [
{ systemId: "attacks", label: "Attacks", icon: "fa-solid fa-sword" },
{ systemId: "spells", label: "Spells", icon: "fa-solid fa-wand-sparkles" },
{ systemId: "skills", label: "Skills", icon: "fa-solid fa-list" },
{ systemId: "inventory", label: "Items", icon: "fa-solid fa-bag-shopping" },
], {
priority: 0,
mode: "replace",
source: "my-module",
});
Define visual presets for status effects:
api.registerDefaultStatusEffects("my-system", [
{
id: "dead",
label: "Dead",
filters: {
grayscale: 100,
brightness: 50,
contrast: 120,
blur: 0,
saturate: 0,
sepia: 0,
},
overlayPath: "icons/svg/skull.svg",
overlayScale: 1.0,
overlayX: 0,
overlayY: 0,
overlayOpacity: 0.8,
overlayBlend: "normal",
animation: "pulse",
tintColor: "#000000",
tintAlpha: 0.6,
tintAnimation: "",
},
{
id: "unconscious",
label: "Unconscious",
filters: {
grayscale: 50,
brightness: 80,
contrast: 100,
blur: 1,
saturate: 50,
sepia: 0,
},
tintColor: "#333333",
tintAlpha: 0.4,
},
], {
priority: 0,
mode: "replace",
source: "my-module",
});
Suggest attributes that users can track:
api.registerTrackableAttributes("my-system", (context) => {
// Can be a function for dynamic generation
const actor = context.actor;
const attributes = [];
if (actor?.system?.health) {
attributes.push({
path: "system.health.value",
label: "Health",
});
}
return attributes;
}, {
mode: "append", // Add to adapter's suggestions
source: "my-module",
});
| Mode | Description |
|---|---|
replace |
Completely replace adapter defaults |
append |
Add after adapter defaults |
prepend |
Add before adapter defaults |