Skip to content

modifier color option - #349

Open
JohnPHowe wants to merge 3 commits into
spatialillusions:masterfrom
JohnPHowe:feature/modifier-color-option
Open

modifier color option#349
JohnPHowe wants to merge 3 commits into
spatialillusions:masterfrom
JohnPHowe:feature/modifier-color-option

Conversation

@JohnPHowe

Copy link
Copy Markdown

Implements a fix for #348

Add a modifierColor style property that is checked first in the decision chain. When set it takes priority; when
absent (the default) behaviour is identical to before.

src/ms/symbol.js
this.style.modifierColor = ""; // override stroke colour for modifier decorators (HQ staff, TF brackets, feint/dummy,
echelon)

src/symbolfunctions/modifier.js
const color = this.style.modifierColor
? this.style.modifierColor
: this.style.frameColor
? this.style.frameColor[this.metadata.affiliation]
: this.colors.iconColor[this.metadata.affiliation];

Usage

// Keep modifiers black when using a coloured frame with no fill
new ms.Symbol(sidc, {
fill: false,
frameColor: { Friend: "rgb(0,168,220)", Hostile: "rgb(255,48,49)", ... },
modifierColor: "rgb(0,0,0)",
});

Backwards compatibility

Fully backwards-compatible. modifierColor defaults to "" (falsy), so the existing frameColor → iconColor fallback
chain is unchanged for all current callers.

John Howe and others added 2 commits June 26, 2026 14:41
…oke colour

When frameColor is passed as a non-empty object the same colour cascades
into modifier decorators (HQ staff line, task-force brackets, feint/dummy
arrow, echelon and mobility indicators) via modifier.js. There is currently
no way to keep those decorators black while using a custom frame/icon colour.

Add modifierColor as an optional style property (default: ''). When set it
is used directly as the modifier stroke colour, taking priority over the
existing frameColor / iconColor fallback chain. The change is fully
backwards-compatible: existing callers that do not set modifierColor see
identical behaviour.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@spatialillusions

Copy link
Copy Markdown
Owner

Documentation and type script definitions needs to be updated as well and included in the pull.

Documents the modifierColor style option added in the previous commit:
- index.d.ts: adds modifierColor?: string to SymbolOptions interface
- docs/README.md: adds modifierColor row to the Style options table
@JohnPHowe

Copy link
Copy Markdown
Author

@spatialillusions sorry for the long delay. Please let me know if anything else is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants