Patitotective / ImThemes

Dear ImGui style browser and editor written in Nim
MIT License
348 stars 74 forks source link

Add JSON exporting support #6

Open aquafir opened 2 years ago

aquafir commented 2 years ago

Would it be possible to add support for exporting JSON?

The toml export wouldn't be hard to convert from, but JSON is already supported for sharing themes by the implementation of ImGui I'm looking at.

It would look like:

{
  "Author": "[optional]",
  "Description": "[optional]",
  "Colors": {
    "Success": [0, 1, 0, 1],
    "Warning": [1, 1, 0, 1],
    ...
  },
  "Options": {
    "Alpha": 1.0,
    "DisabledAlpha": 0.6,
    ...
  }
}

Thanks for the great tool!

Patitotective commented 2 years ago

It looks like something quite easy to add. Just to know what ImGui implementation shares themes through a JSON file? Also for enums like ImGuiDir do you expect a string or an integer?

aquafir commented 1 year ago

Just to know what ImGui implementation shares themes through a JSON file?

UtilityBelt is currently using it.

The person working on ImGui support doesn't have any problems with adding support for toml, but I thought JSON support might be useful for others as a common choice for serialization.

Also for enums like ImGuiDir do you expect a string or an integer?

I think typically this defaults to an integer but either way would be fine. A string might be more useful to anyone reading the JSON?