Files
kanhole/client/gui/theme.go
T
akukanara f4a88f4b2c
golangci-lint / lint (push) Failing after 4s
feat(gui): redesign kanholec GUI with modern interface and WiX v7 installer
- Complete GUI overhaul with Fyne framework
  * Modern dark theme with indigo/pink accent colors
  * 4-step setup wizard (Welcome → Server → Auth → Finish)
  * Dashboard with proxy list, real-time logs, and config viewer
  * Windows Service manager (install/start/stop/uninstall)
  * System tray integration with quick controls

- WiX v7 MSI installer
  * Auto-registers as Windows Service (manual start)
  * Feature tree UI for optional components
  * Desktop shortcut and PATH options
  * Build script: packaging/windows/build-msi.ps1

- Build system updates
  * Added kanholec-windows-gui target (CGO required)
  * Added kanholec-windows-msi target
  * Separate main_gui.go entry point for GUI builds

GUI binary: bin/kanholec-windows-amd64.exe (31.4 MB)
MSI installer: bin/kanholec-0.69.0-amd64.msi (12.1 MB)
2026-05-29 22:53:41 +07:00

125 lines
3.6 KiB
Go

//go:build kanholec_gui
package gui
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
)
var (
colorPrimary = color.NRGBA{R: 99, G: 102, B: 241, A: 255}
colorPrimaryDark = color.NRGBA{R: 79, G: 70, B: 229, A: 255}
colorSecondary = color.NRGBA{R: 236, G: 72, B: 153, A: 255}
colorBackground = color.NRGBA{R: 17, G: 24, B: 39, A: 255}
colorSurface = color.NRGBA{R: 31, G: 41, B: 55, A: 255}
colorForeground = color.NRGBA{R: 243, G: 244, B: 246, A: 255}
colorButton = color.NRGBA{R: 55, G: 65, B: 81, A: 255}
colorHover = color.NRGBA{R: 75, G: 85, B: 99, A: 255}
colorDisabled = color.NRGBA{R: 107, G: 114, B: 128, A: 255}
colorInputBorder = color.NRGBA{R: 75, G: 85, B: 99, A: 255}
colorPlaceholder = color.NRGBA{R: 156, G: 163, B: 175, A: 255}
colorSuccess = color.NRGBA{R: 34, G: 197, B: 94, A: 255}
colorWarning = color.NRGBA{R: 251, G: 146, B: 60, A: 255}
colorError = color.NRGBA{R: 239, G: 68, B: 68, A: 255}
colorSeparator = color.NRGBA{R: 55, G: 65, B: 81, A: 255}
colorAccent = color.NRGBA{R: 139, G: 92, B: 246, A: 255}
)
type kanholeTheme struct{}
var _ fyne.Theme = (*kanholeTheme)(nil)
func (t *kanholeTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
switch name {
case theme.ColorNameBackground:
return colorBackground
case theme.ColorNameForeground, theme.ColorNameForegroundOnPrimary:
return colorForeground
case theme.ColorNamePrimary:
return colorPrimary
case theme.ColorNameButton:
return colorButton
case theme.ColorNameHover:
return colorHover
case theme.ColorNameDisabled:
return colorDisabled
case theme.ColorNameDisabledButton:
return color.NRGBA{R: 45, G: 55, B: 72, A: 255}
case theme.ColorNameInputBorder:
return colorInputBorder
case theme.ColorNamePlaceHolder:
return colorPlaceholder
case theme.ColorNameScrollBar:
return color.NRGBA{R: 107, G: 114, B: 128, A: 180}
case theme.ColorNameShadow:
return color.NRGBA{R: 0, G: 0, B: 0, A: 100}
case theme.ColorNameSeparator:
return colorSeparator
case theme.ColorNameFocus:
return color.NRGBA{R: 99, G: 102, B: 241, A: 140}
case theme.ColorNameSelection:
return color.NRGBA{R: 99, G: 102, B: 241, A: 80}
case theme.ColorNameInputBackground:
return colorSurface
case theme.ColorNameHeaderBackground:
return color.NRGBA{R: 17, G: 24, B: 39, A: 255}
default:
return theme.DefaultTheme().Color(name, theme.VariantDark)
}
}
func (t *kanholeTheme) Font(style fyne.TextStyle) fyne.Resource {
return theme.DefaultTheme().Font(style)
}
func (t *kanholeTheme) Icon(name fyne.ThemeIconName) fyne.Resource {
return theme.DefaultTheme().Icon(name)
}
func (t *kanholeTheme) Size(name fyne.ThemeSizeName) float32 {
switch name {
case theme.SizeNamePadding:
return 10
case theme.SizeNameInnerPadding:
return 8
case theme.SizeNameLineSpacing:
return 32
case theme.SizeNameScrollBar:
return 10
case theme.SizeNameScrollBarSmall:
return 5
case theme.SizeNameText:
return 14
case theme.SizeNameHeadingText:
return 28
case theme.SizeNameSubHeadingText:
return 18
case theme.SizeNameCaptionText:
return 12
case theme.SizeNameInputBorder:
return 2
case theme.SizeNameInputRadius:
return 10
case theme.SizeNameSelectionRadius:
return 8
default:
return theme.DefaultTheme().Size(name)
}
}
func StatusColor(s string) color.Color {
switch s {
case "running", "connected", "ok", "active":
return colorSuccess
case "warning", "reconnecting":
return colorWarning
case "error", "stopped", "failed", "disconnected":
return colorError
default:
return colorPlaceholder
}
}