ImStyle is a library that helps you to manage your Dear ImGui application's style. Load the style from a KDL file rather than hard-coding it into your app. Using ImStyle also allows you to change your app's style without compiling it again (since the style is read from a file).
Without ImStyle you need to set the style in your code:
import nimgl/imgui ... let style = igGetStyle() style.alpha = 1f style.windowPadding = ImVec2(x: 4f, y: 4f) style.windowMenuButtonPosition = ImGuiDir.Left style.colors[ord Text] = ImVec4(x: 0f, y: 0f, z: 0f, w: 1f) # RGBA ...Using ImStyle you will only need to create a KDL file (e.i.: style.kdl), that will look like:
# ImStyle
alpha 1 # -> 1.0
windowPadding 4 4 # -> ImVec2(x: 4.0, y: 4.0)
windowMenuButtonPosition "Left" # ImGuiDir.Left
...
colors {
Text 0 0 0 1 # -> ImVec4(x: 0f, y: 0f, z: 0f, w: 1f)
...
} And load it in your code:
import imstyle ... parseKdlFile("style.kdl").loadStyle().setCurrent() ...
Types
ImStyleError = object of CatchableError
- Source Edit
Procs
proc initHookKdl(v: var ImGuiStyle) {....raises: [], tags: [], forbids: [].}
- Source Edit
proc initImGuiStyle(): ImGuiStyle {....raises: [], tags: [], forbids: [].}
- Source Edit
proc setCurrent(style: ImGuiStyle) {....raises: [], tags: [], forbids: [].}
- Source Edit