Skip to content

Commit b61ff4d

Browse files
NikolaiFaNikolaiFa
authored andcommitted
Add icon theming support
1 parent 5180a79 commit b61ff4d

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

docs/2_4_common_schema.adoc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,22 @@ This enables high quality rendering and printing in importers.
18631863
The point (`x1`, `y1`) maps to the left lower corner of the PNG image or SVG viewport.
18641864
The point (`x2`, `y2`) maps to the right upper corner of the PNG image or SVG viewport.
18651865

1866+
====== Icon Theming
1867+
1868+
To support different user interface themes (e.g., light and dark mode), additional themed icon files may be provided alongside the default icon files.
1869+
Importers should select the appropriate icon file based on their current theme.
1870+
1871+
The naming convention for themed icon files is:
1872+
1873+
* `terminalsAndIcons/icon.png` and optionally `terminalsAndIcons/icon.svg` - Default icon (light theme)
1874+
* `terminalsAndIcons/icon-dark.png` and optionally `terminalsAndIcons/icon-dark.svg` - Dark theme variant
1875+
* `terminalsAndIcons/icon-{theme}.png` and optionally `terminalsAndIcons/icon-{theme}.svg` - Custom theme variants
1876+
1877+
All themed icon variants should use the same coordinate positioning as defined in the `<Icon>` element, as changing layout when switching themes would be undesirable.
1878+
1879+
_[Importers should check for themed icon files matching their current theme before falling back to the default icon._
1880+
_The default icon file (`icon.png`) should always be provided to ensure backward compatibility with importers that do not support theming.]_
1881+
18661882
====== Placement, Extent, and Painting Order of Graphical Items
18671883

18681884
image::images/GraphicalRepresentation.svg[width=70%, pdfwidth=70%, align="center"]
@@ -2105,6 +2121,19 @@ An additional SVG file with extension '.svg' is optional.
21052121

21062122
_[Note that this specification is functionally equivalent to looking up image sources from the `terminalsAndIcons` folder of the FMU ZIP archive after dot removal from the path as per section 5.2.4 of RFC 3986.]_
21072123

2124+
Similar to FMU icons, terminal icons may be provided in multiple theme variants to support different user interface themes.
2125+
The naming convention for themed terminal icon files follows the FMU icon pattern:
2126+
2127+
* `terminalsAndIcons/{iconBaseName}.png` and optionally `{iconBaseName}.svg` - Default terminal icon (light theme)
2128+
* `terminalsAndIcons/{iconBaseName}-dark.png` and optionally `{iconBaseName}-dark.svg` - Dark theme variant
2129+
* `terminalsAndIcons/{iconBaseName}-{theme}.png` and optionally `{iconBaseName}-{theme}.svg` - Custom theme variants
2130+
2131+
All themed terminal icon variants should use the same coordinate positioning as defined in the `<TerminalGraphicalRepresentation>` element.
2132+
2133+
_[Importers should check for themed terminal icon files matching their current theme before falling back to the default icon._
2134+
_The default icon file (with no theme suffix) should always be provided to ensure backward compatibility._
2135+
_Note that theme-specific connection colors cannot be specified in the XML, so the `defaultConnectionColor` applies to all themes.]_
2136+
21082137
The `defaultConnectionStrokeSize` and `defaultConnectionColor` can be provided to define the intended connection line layout in the importer.
21092138
The stroke size is given relative to the coordinate system extent.
21102139
The stroke color is given in RGB values from 0 to 255. E.g.: `255 255 0`.

docs/2_5_fmu_distribution.adoc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ terminalsAndIcons // FMU and terminal icons (optional)
4444
terminalsAndIcons.xml // description of terminals and icons (optional)
4545
icon.png // image file of icon without terminals (optional)
4646
icon.svg // if existing the icon.png is required (optional)
47+
icon-dark.png // image file for dark theme (optional)
48+
icon-dark.svg // if existing the icon-dark.png is required (optional)
49+
icon-{theme}.png // image file for custom theme icons (optional)
50+
icon-{theme}.svg // SVG file for custom theme icons (optional)
4751
// all terminal and fmu icons referenced in the
4852
// graphical representation
4953
sources // directory containing the C sources (optional)
@@ -79,6 +83,23 @@ _This will help the users to comply with license conditions when passing source
7983

8084
See <<fmiTerminalsAndIcons>> for a definition of the directory `terminalsAndIcons`.
8185

86+
The `terminalsAndIcons` directory contains the graphical representation metadata and icon image files.
87+
Icon files may be provided in multiple theme variants to support different user interface themes (e.g., light and dark mode).
88+
89+
The following files may be present:
90+
91+
* `terminalsAndIcons.xml` - XML file defining terminals and graphical representations
92+
* `icon.png` - FMU icon (required if any icons are provided)
93+
* `icon.svg` - Optional SVG version of the FMU icon
94+
* `icon-dark.png` - Optional dark theme variant of the FMU icon
95+
* `icon-dark.svg` - Optional SVG version of the dark theme icon
96+
* `icon-{theme}.png` - Optional custom theme variants of the FMU icon
97+
* `icon-{theme}.svg` - Optional SVG versions of custom theme icons
98+
* Terminal icon files following the naming convention: `{iconBaseName}.png`, `{iconBaseName}-dark.png`, `{iconBaseName}-{theme}.png`, and their optional `.svg` counterparts, as specified by `iconBaseName` attributes in `terminalsAndIcons.xml`
99+
100+
_[When providing themed icon variants, the default icon file (without theme suffix) must always be provided to ensure backward compatibility with importers that do not support theming._
101+
_All themed variants should have the same dimensions and positioning as defined in the `terminalsAndIcons.xml` file.]_
102+
82103
===== Directory `sources` [[sources-directory]]
83104

84105
A source code FMU contains the sources of the model in the `sources` directory together with a `buildDescription.xml` that contains at least one <<BuildConfiguration>> element for the supported platforms.

0 commit comments

Comments
 (0)