modifier color option - #349
Open
JohnPHowe wants to merge 3 commits into
Open
Conversation
…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>
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
Author
|
@spatialillusions sorry for the long delay. Please let me know if anything else is needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.