Skip to content

Comments

[core] Dynamic styles#11654

Open
AndrewShkrob wants to merge 11 commits intoorganicmaps:masterfrom
AndrewShkrob:core/dynamic-styles
Open

[core] Dynamic styles#11654
AndrewShkrob wants to merge 11 commits intoorganicmaps:masterfrom
AndrewShkrob:core/dynamic-styles

Conversation

@AndrewShkrob
Copy link
Member

@AndrewShkrob AndrewShkrob commented Nov 2, 2025

A little step towards dynamic styles support

Style:
Style is a folder that contains all required resources.
Folder can be considered as a style folder when it contains style.json in its root
style.json:

{
  "name": "default",
  "light": {
    "drulesPath": "light/drules.bin",
    "symbolsPath": "light/symbols"
  },
  "dark": {
    "drulesPath": "dark/drules.bin",
    "symbolsPath": "dark/symbols"
  },
  "colorsPath": "colors.txt",
  "transitColorsPath": "transit_colors.txt",
  "patternsPath": "patterns.txt"
}

All paths in style.json are relative. A path to the file outside the style folder can be declared as ../../whatever.txt. Example:

{
  "name": "outdoors",
  "light": {
    "drulesPath": "light/drules.bin",
    "symbolsPath": "../default/light/symbols"
  },
  "dark": {
    "drulesPath": "dark/drules.bin",
    "symbolsPath": "../default/dark/symbols"
  },
  "colorsPath": "../default/colors.txt",
  "transitColorsPath": "../default/transit_colors.txt",
  "patternsPath": "../default/patterns.txt"
}

Data:

  • New styles dir for compiled styles. This folder (or its subfolders) will be bundled into the app
├── common
│   └── ...
├── default
│   ├── colors.txt
│   ├── dark
│   │   ├── drules.bin
│   │   └── symbols/
│   ├── light
│   │   ├── drules.bin
│   │   └── symbols/
│   ├── patterns.txt
│   ├── style.json
│   └── transit_colors.txt
├── merged
├── outdoors
└── vehicle
  • Styles' sources are moved into styles-raw. This folder won't be bundled into the app. Do you have a better name for styles-raw?

Libs:

  • New styles lib

Tools:

Android:

  • Updated assets

iOS:

  • Created a new shell script build step to copy styles into resources dir

Limitations:

  • As I already said, this is just a first step. Dynamic styles are not supported yet. The 3 styles we have are hardcoded and even if you add a new style you won't be able to use it

@AndrewShkrob AndrewShkrob added Core Cross-platform C++ libraries with a core functionality Styles Map drawing styles labels Nov 2, 2025
@AndrewShkrob AndrewShkrob requested review from a team as code owners November 2, 2025 22:56
@AndrewShkrob AndrewShkrob marked this pull request as draft November 2, 2025 22:56
Signed-off-by: Andrei Shkrob <github@shkrob.dev>
Signed-off-by: Andrei Shkrob <github@shkrob.dev>
Signed-off-by: Andrei Shkrob <github@shkrob.dev>
Signed-off-by: Andrei Shkrob <github@shkrob.dev>
Signed-off-by: Andrei Shkrob <github@shkrob.dev>
Signed-off-by: Andrei Shkrob <github@shkrob.dev>
Signed-off-by: Andrei Shkrob <github@shkrob.dev>
Signed-off-by: Andrei Shkrob <github@shkrob.dev>
@AndrewShkrob AndrewShkrob marked this pull request as ready for review November 3, 2025 18:54
Signed-off-by: Andrei Shkrob <github@shkrob.dev>
Signed-off-by: Andrei Shkrob <github@shkrob.dev>
Signed-off-by: Andrei Shkrob <github@shkrob.dev>
@AndrewShkrob
Copy link
Member Author

@vng @biodranik Are you interested in this feature?

@vng
Copy link
Member

vng commented Dec 5, 2025

  • colors, patterns (probably some else) files are needed in general (drape)- not depending on particular style.
  • move drules_proto_* into corresponding folders - maybe ok, depends on pros.
  • Why Theme was added to the C++ core? Core is about map, not UI.

@AndrewShkrob
Copy link
Member Author

Why Theme was added to the C++ core? Core is about map, not UI.

Then why do we have map style in the core? I did not add anything new. I only changed the interface
Previously

MapStyleNormalLight
MapStyleNormalDark
MapStyleDrivingLight
MapStyleDrivingDark
....

Now

MapStyleNormal
MapStyleDriving

MapThemeLight
MapThemeDark

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

Labels

Core Cross-platform C++ libraries with a core functionality Styles Map drawing styles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants