Skip to content

Commit

Permalink
wrap webui_set_high_contrast_support and `webui_user_prefers_high_c…
Browse files Browse the repository at this point in the history
…ontrast`
  • Loading branch information
neroist committed Jun 25, 2024
1 parent c922a19 commit 776bee5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions webui.nim
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ proc setTlsCertificate*(certificate_pem, private_key_pem: string): bool =

bindings.setTlsCertificate(cstring certificate_pem, cstring private_key_pem)

proc userPrefersHighContrast*(): bool =
## Get the user's high contrast preference.
##
## Returns `true` if the user is prefers the high contrast theme

bindings.userPrefersHighContrast()

# ------- Impl funcs --------

# --- Event ---
Expand Down Expand Up @@ -407,6 +414,14 @@ proc `hidden=`*(window: Window; status: bool) =

bindings.setHide(csize_t window, status)

proc `highContrastSupport`*(window: Window; status: bool) =
## Set the window's high contrast support. This is useful when thedefault high
## contrast support of the browser is not operating correctly or you want to build better
## high contrast theme by CSS.
##
## :window: The window to set the high contrast theme support for
## :status: Whether or not to support high contrast themes.

proc setSize*(window: Window; width, height: int) =
## Set the window size.
##
Expand Down
8 changes: 8 additions & 0 deletions webui/bindings.nim
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,14 @@ proc showWv*(window: csize_t; content: cstring): bool {.webui, importc: "webui_s
proc setKiosk*(window: csize_t; status: bool) {.webui, importc: "webui_set_kiosk".}
## Set the window in Kiosk mode (Full screen)

proc setHighContrastSupport*(window: csize_t; status: bool) {.webui, importc: "webui_set_high_contrast_support".}
## Set the window's high contrast support. This is useful when thedefault high
## contrast support of the browser is not operating correctly or you want to build better
## high contrast theme by CSS.

proc userPrefersHighContrast*(): bool {.webui, importc: "webui_user_prefers_high_contrast".}
## Get the user's high contrast preference.

proc wait*() {.webui, importc: "webui_wait".}
## Wait until all opened windows get closed.

Expand Down

0 comments on commit 776bee5

Please sign in to comment.