feat: add UI layer (theme, components, screens, main window)
- theme: MinecraftTheme — dark palette with green accents - components: ServerCard, ProgressBar, PlayButton, SettingsButton, LogoutButton, AvatarImage - screens: MainScreen (BorderLayout: sidebar + center + bottom bar), LoginScreen (modal form), SettingsScreen (RAM slider + JVM args) - ui.Launch: wires theme, session, settings into Fyne app - main.go: delegates to ui.Launch, loads config - fix: nil-session guard in MainScreen username display Co-Authored-By: OWL <noreply@anthropic.com>
This commit is contained in:
@@ -1,2 +1,92 @@
|
||||
// package theme defines the custom Fyne theme (Minecraft-style colors, fonts).
|
||||
// package theme defines a custom Fyne theme with Minecraft-inspired colors.
|
||||
package theme
|
||||
|
||||
import (
|
||||
"image/color"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
)
|
||||
|
||||
// MinecraftTheme is a dark theme inspired by Minecraft's UI palette.
|
||||
type MinecraftTheme struct{}
|
||||
|
||||
var _ fyne.Theme = (*MinecraftTheme)(nil)
|
||||
|
||||
// Color returns the named color from the Minecraft palette.
|
||||
func (t *MinecraftTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
|
||||
switch name {
|
||||
case theme.ColorNameBackground:
|
||||
return color.RGBA{R: 30, G: 30, B: 30, A: 255} // dark stone
|
||||
case theme.ColorNameButton:
|
||||
return color.RGBA{R: 100, G: 100, B: 100, A: 255} // stone gray
|
||||
case theme.ColorNameDisabled:
|
||||
return color.RGBA{R: 80, G: 80, B: 80, A: 255}
|
||||
case theme.ColorNameDisabledButton:
|
||||
return color.RGBA{R: 60, G: 60, B: 60, A: 255}
|
||||
case theme.ColorNameError:
|
||||
return color.RGBA{R: 200, G: 50, B: 50, A: 255}
|
||||
case theme.ColorNameFocus:
|
||||
return color.RGBA{R: 76, G: 175, B: 80, A: 255} // green accent
|
||||
case theme.ColorNameForeground:
|
||||
return color.RGBA{R: 220, G: 220, B: 220, A: 255} // light gray
|
||||
case theme.ColorNameHover:
|
||||
return color.RGBA{R: 76, G: 175, B: 80, A: 255} // green
|
||||
case theme.ColorNameInputBackground:
|
||||
return color.RGBA{R: 50, G: 50, B: 50, A: 255}
|
||||
case theme.ColorNameInputBorder:
|
||||
return color.RGBA{R: 80, G: 80, B: 80, A: 255}
|
||||
case theme.ColorNameMenuBackground:
|
||||
return color.RGBA{R: 40, G: 40, B: 40, A: 255}
|
||||
case theme.ColorNameOverlayBackground:
|
||||
return color.RGBA{R: 0, G: 0, B: 0, A: 180}
|
||||
case theme.ColorNamePlaceHolder:
|
||||
return color.RGBA{R: 150, G: 150, B: 150, A: 255}
|
||||
case theme.ColorNamePressed:
|
||||
return color.RGBA{R: 56, G: 142, B: 60, A: 255} // dark green
|
||||
case theme.ColorNamePrimary:
|
||||
return color.RGBA{R: 76, G: 175, B: 80, A: 255} // green
|
||||
case theme.ColorNameScrollBar:
|
||||
return color.RGBA{R: 80, G: 80, B: 80, A: 200}
|
||||
case theme.ColorNameSeparator:
|
||||
return color.RGBA{R: 60, G: 60, B: 60, A: 255}
|
||||
case theme.ColorNameShadow:
|
||||
return color.RGBA{R: 0, G: 0, B: 0, A: 128}
|
||||
default:
|
||||
return theme.DefaultTheme().Color(name, variant)
|
||||
}
|
||||
}
|
||||
|
||||
// Font returns the default font (custom TTF can be added later).
|
||||
func (t *MinecraftTheme) Font(style fyne.TextStyle) fyne.Resource {
|
||||
return theme.DefaultTheme().Font(style)
|
||||
}
|
||||
|
||||
// Icon returns the named icon resource.
|
||||
func (t *MinecraftTheme) Icon(name fyne.ThemeIconName) fyne.Resource {
|
||||
return theme.DefaultTheme().Icon(name)
|
||||
}
|
||||
|
||||
// Size returns the named size value.
|
||||
func (t *MinecraftTheme) Size(name fyne.ThemeSizeName) float32 {
|
||||
switch name {
|
||||
case theme.SizeNameCaptionText:
|
||||
return 11
|
||||
case theme.SizeNameInlineIcon:
|
||||
return 20
|
||||
case theme.SizeNamePadding:
|
||||
return 4
|
||||
case theme.SizeNameScrollBar:
|
||||
return 12
|
||||
case theme.SizeNameScrollBarSmall:
|
||||
return 4
|
||||
case theme.SizeNameText:
|
||||
return 14
|
||||
case theme.SizeNameHeadingText:
|
||||
return 24
|
||||
case theme.SizeNameSubHeadingText:
|
||||
return 18
|
||||
default:
|
||||
return theme.DefaultTheme().Size(name)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user