milsymbol’s color system is built around ColorMode objects — plain objects that map each tactical affiliation (Civilian, Friend, Hostile, Neutral, Unknown, Suspect) to a CSS color string. When a symbol is rendered, milsymbol looks up the correct color for its affiliation from the active color mode. Nine color modes are registered automatically at startup (Light, Medium, Dark, FrameColor, IconColor, Black, White, OffWhite, None), and you can register your own withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/spatialillusions/milsymbol/llms.txt
Use this file to discover all available pages before exploring further.
ms.setColorMode() or pass a ColorMode object directly to a symbol’s colorMode option.
ms.ColorMode()
Creates a new ColorMode object with colors for each tactical affiliation.CSS color value applied to Civilian-affiliated symbols.
CSS color value applied to Friend-affiliated symbols.
CSS color value applied to Hostile-affiliated symbols.
CSS color value applied to Neutral-affiliated symbols.
CSS color value applied to Unknown-affiliated symbols.
CSS color value applied to Suspect-affiliated symbols (used in MIL-STD-2525E).
ColorMode object:
Example — creating a custom neon color mode
ms.setColorMode()
Registers aColorMode under a name so it can be retrieved later by string. If a mode with the given name already exists it is overwritten.
The name to register the color mode under (e.g.
"Neon", "Dark").The
ColorMode object returned by ms.ColorMode().ColorMode object.
Example
ms.getColorMode()
Retrieves aColorMode that was previously registered with ms.setColorMode(). All nine built-in modes (see table below) are available immediately after import.
The name of a color mode registered with
ms.setColorMode(). Built-in names: "Light", "Medium", "Dark", "FrameColor", "IconColor", "Black", "White", "OffWhite", "None".ColorMode object.
Example
Built-in color modes
Nine color modes are registered automatically when milsymbol is loaded.| Name | Purpose |
|---|---|
| Light | Light pastel fill colors — the default colorMode for new symbols. |
| Medium | Saturated mid-tone fill colors. |
| Dark | Dark fill colors, useful on light map backgrounds. |
| FrameColor | Full-saturation frame colors for use with unfilled (fill: false) symbols. |
| IconColor | Full-saturation icon colors for unfilled and unframed symbols. |
| Black | All affiliations render as "black". |
| White | All affiliations render as "white". |
| OffWhite | All affiliations render as rgb(239, 239, 239) — used internally for white icon parts. |
| None | All affiliations are false (transparent / no color). |
Affiliation color values
ms.BBox()
Creates a bounding box object used throughout milsymbol to describe the spatial extent of drawn elements. When creating custom symbol parts or icon extensions you will need to construct and return aBBox to inform milsymbol how much space your additions occupy.
Left coordinate of the bounding box. Defaults to
100.Top coordinate of the bounding box. Defaults to
100.Right coordinate of the bounding box. Defaults to
100.Bottom coordinate of the bounding box. Defaults to
100.BBoxObject with x1, y1, x2, y2 properties and the following methods:
| Method | Description |
|---|---|
width() | Returns x2 - x1. |
height() | Returns y2 - y1. |
merge(box) | Expands this box to encompass box as well; returns this. |
milsymbol’s symbol octagon has its origin at
(100, 100) with a width and height of 100. When building custom draw instructions, place geometry relative to that coordinate system.