Closed malisipi closed 3 months ago
I am not much knowledge about WebUI Frontend API. So I couldn't implement the API however since backend is exist of API, it should not be hard. Also I have not a Mac computer, so I can not implement detecting on MacOS.
Thank you @malisipi for this new feature, I will try to implement the macOS and frontend part later.
Backend (https://github.com/webui-dev/webui/commit/acc77ce5d22cb4883ecee73abfd9a22ee2ed99e4). Frontend (https://github.com/webui-dev/webui/commit/88cd5f3774a00ff37a2fdf5557e4f3e76fcf5a58).
Thank you @malisipi for the idea of frontend, now, we have an easy mechanism to internally call any core API from Bridge:
Bridge:
async isHighContrast(): Promise<boolean> {
// Call a core function and wait for response
const response = await this.callCore("_YOUR_CORE_SHORT_ID_HERE_") as boolean; // Any datatype
if (this.#log) console.log(`Core Response: [${response}]`);
return response;
}
webui.c:
static void _webui_bridge_api_handler(webui_event_t* e) {
// ...
if (strcmp(api_name, "_YOUR_CORE_SHORT_ID_HERE_") == 0) {
webui_return_bool(e, webui_is_high_contrast()); // Any API
}
}
To get more information about why it's required, you can browse #432.
--disable-features=ForcedColors
command line flag)--disable-features=ForcedColors
command line flag)browser.display.document_color_use=1
onWebUI-NoHC
profile)HKEY_CURRENT_USER\Control Panel\Accessibility\HighContrast
->Flags
)gsettings get org.gnome.desktop.a11y.interface high-contrast
)