mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 21:29:09 +08:00

* Add Windows version helper * Initial theme support * Support custom themes * Update docs * Honour HighContrast theme. Remove import "C". Refactor * Small refactor * Support inactive theme * Update Docs
58 lines
1.6 KiB
Go
58 lines
1.6 KiB
Go
package windows
|
|
|
|
type Theme int
|
|
|
|
const (
|
|
// SystemDefault will use whatever the system theme is. The application will follow system theme changes.
|
|
SystemDefault Theme = 0
|
|
// Dark Mode
|
|
Dark Theme = 1
|
|
// Light Mode
|
|
Light Theme = 2
|
|
)
|
|
|
|
func RGB(r, g, b uint8) int32 {
|
|
var col = int32(b)
|
|
col = col<<8 | int32(g)
|
|
col = col<<8 | int32(r)
|
|
return col
|
|
}
|
|
|
|
// ThemeSettings contains optional colours to use.
|
|
// They may be set using the hex values: 0x00BBGGRR
|
|
type ThemeSettings struct {
|
|
DarkModeTitleBar int32
|
|
DarkModeTitleBarInactive int32
|
|
DarkModeTitleText int32
|
|
DarkModeTitleTextInactive int32
|
|
DarkModeBorder int32
|
|
DarkModeBorderInactive int32
|
|
LightModeTitleBar int32
|
|
LightModeTitleBarInactive int32
|
|
LightModeTitleText int32
|
|
LightModeTitleTextInactive int32
|
|
LightModeBorder int32
|
|
LightModeBorderInactive int32
|
|
}
|
|
|
|
// Options are options specific to Windows
|
|
type Options struct {
|
|
WebviewIsTransparent bool
|
|
WindowIsTranslucent bool
|
|
DisableWindowIcon bool
|
|
|
|
// Disable all window decorations in Frameless mode, which means no "Aero Shadow" and no "Rounded Corner" will be shown.
|
|
// "Rounded Corners" are only available on Windows 11.
|
|
DisableFramelessWindowDecorations bool
|
|
|
|
// Path where the WebView2 stores the user data. If empty %APPDATA%\[BinaryName.exe] will be used.
|
|
// If the path is not valid, a messagebox will be displayed with the error and the app will exit with error code.
|
|
WebviewUserDataPath string
|
|
|
|
// Dark/Light or System Default Theme
|
|
Theme Theme
|
|
|
|
// Custom settings for dark/light mode
|
|
CustomTheme *ThemeSettings
|
|
}
|