Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme adwaita - icons and enhancements #68

Merged
merged 12 commits into from
Oct 16, 2023
22 changes: 16 additions & 6 deletions theme/adwaita.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@ import (
"fyne.io/fyne/v2/theme"
)

// must be in sync with adwaita_colors_generator.go - getting the colors from the Adwaita document page.
//go:generate go run ./adwaita_colors_generator.go
//go:generate go run ./adwaita_theme_generator.go

var _ fyne.Theme = (*Adwaita)(nil)

// Adwaita is a theme that follows the Adwaita theme. It provides a light and dark theme + icons.
// See: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/named-colors.html
type Adwaita struct{}

// AdwaitaTheme returns a new Adwaita theme.
func AdwaitaTheme() fyne.Theme {
return &Adwaita{}
}

// Adwaita is a theme that follows the Adwaita theme.
// See: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/named-colors.html
type Adwaita struct{}

// Color returns the named color for the current theme.
func (a *Adwaita) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
switch variant {
Expand All @@ -43,10 +42,21 @@ func (a *Adwaita) Font(style fyne.TextStyle) fyne.Resource {

// Icon returns the named resource for the current theme.
func (a *Adwaita) Icon(name fyne.ThemeIconName) fyne.Resource {
if icon, ok := adwaitaIcons[name]; ok {
return icon
}
return theme.DefaultTheme().Icon(name)
}

// Size returns the size of the named resource for the current theme.
func (a *Adwaita) Size(name fyne.ThemeSizeName) float32 {
switch name {
case theme.SizeNamePadding:
return 8
case theme.SizeNameInlineIcon:
return 16
case theme.SizeNameText:
return 12
}
return theme.DefaultTheme().Size(name)
}
84 changes: 43 additions & 41 deletions theme/adwaita_colors.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package theme

// This file is generated by adwaita_colors_generator.go
// This file is generated by adwaita_theme_generator.go
// Please do not edit manually, use:
// go generate ./theme/...
//
Expand All @@ -14,47 +14,49 @@ import (
)

var adwaitaDarkScheme = map[fyne.ThemeColorName]color.Color{
theme.ColorBlue: color.RGBA{0x35, 0x84, 0xe4, 0xff}, // Adwaita color name @blue_3
theme.ColorBrown: color.RGBA{0x98, 0x6a, 0x44, 0xff}, // Adwaita color name @brown_3
theme.ColorGray: color.RGBA{0x5e, 0x5c, 0x64, 0xff}, // Adwaita color name @dark_2
theme.ColorGreen: color.RGBA{0x26, 0xa2, 0x69, 0xff}, // Adwaita color name @green_5
theme.ColorNameBackground: color.RGBA{0x24, 0x24, 0x24, 0xff}, // Adwaita color name @window_bg_color
theme.ColorNameButton: color.RGBA{0x30, 0x30, 0x30, 0xff}, // Adwaita color name @headerbar_bg_color
theme.ColorNameError: color.RGBA{0xc0, 0x1c, 0x28, 0xff}, // Adwaita color name @error_bg_color
theme.ColorNameForeground: color.RGBA{0xff, 0xff, 0xff, 0xff}, // Adwaita color name @window_fg_color
theme.ColorNameInputBackground: color.RGBA{0x1e, 0x1e, 0x1e, 0xff}, // Adwaita color name @view_bg_color
theme.ColorNameMenuBackground: color.RGBA{0x1e, 0x1e, 0x1e, 0xff}, // Adwaita color name @view_bg_color
theme.ColorNameOverlayBackground: color.RGBA{0x1e, 0x1e, 0x1e, 0xff}, // Adwaita color name @view_bg_color
theme.ColorNamePrimary: color.RGBA{0x35, 0x84, 0xe4, 0xff}, // Adwaita color name @accent_bg_color
theme.ColorNameSelection: color.RGBA{0x35, 0x84, 0xe4, 0xff}, // Adwaita color name @accent_bg_color
theme.ColorNameShadow: color.RGBA{0x00, 0x00, 0x00, 0x5b}, // Adwaita color name @shade_color
theme.ColorNameSuccess: color.RGBA{0x26, 0xa2, 0x69, 0xff}, // Adwaita color name @success_bg_color
theme.ColorNameWarning: color.RGBA{0xcd, 0x93, 0x09, 0xff}, // Adwaita color name @warning_bg_color
theme.ColorOrange: color.RGBA{0xff, 0x78, 0x00, 0xff}, // Adwaita color name @orange_3
theme.ColorPurple: color.RGBA{0x91, 0x41, 0xac, 0xff}, // Adwaita color name @purple_3
theme.ColorRed: color.RGBA{0xc0, 0x1c, 0x28, 0xff}, // Adwaita color name @red_4
theme.ColorYellow: color.RGBA{0xf6, 0xd3, 0x2d, 0xff}, // Adwaita color name @yellow_3
theme.ColorBlue: color.NRGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @blue_3
theme.ColorBrown: color.NRGBA{R: 0x98, G: 0x6a, B: 0x44, A: 0xff}, // Adwaita color name @brown_3
theme.ColorGray: color.NRGBA{R: 0x5e, G: 0x5c, B: 0x64, A: 0xff}, // Adwaita color name @dark_2
theme.ColorGreen: color.NRGBA{R: 0x26, G: 0xa2, B: 0x69, A: 0xff}, // Adwaita color name @green_5
theme.ColorNameBackground: color.NRGBA{R: 0x24, G: 0x24, B: 0x24, A: 0xff}, // Adwaita color name @window_bg_color
theme.ColorNameButton: color.NRGBA{R: 0x30, G: 0x30, B: 0x30, A: 0xff}, // Adwaita color name @headerbar_bg_color
theme.ColorNameError: color.NRGBA{R: 0xc0, G: 0x1c, B: 0x28, A: 0xff}, // Adwaita color name @error_bg_color
theme.ColorNameForeground: color.NRGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}, // Adwaita color name @window_fg_color
theme.ColorNameInputBackground: color.NRGBA{R: 0x1e, G: 0x1e, B: 0x1e, A: 0xff}, // Adwaita color name @view_bg_color
theme.ColorNameMenuBackground: color.NRGBA{R: 0x38, G: 0x38, B: 0x38, A: 0xff}, // Adwaita color name @popover_bg_color
theme.ColorNameOverlayBackground: color.NRGBA{R: 0x1e, G: 0x1e, B: 0x1e, A: 0xff}, // Adwaita color name @view_bg_color
theme.ColorNamePrimary: color.NRGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_bg_color
theme.ColorNameScrollBar: color.NRGBA{R: 0xff, G: 0xff, B: 0xff, A: 0x5b}, // Adwaita color name @light_1
theme.ColorNameSelection: color.NRGBA{R: 0x30, G: 0x30, B: 0x30, A: 0xff}, // Adwaita color name @headerbar_bg_color
theme.ColorNameShadow: color.NRGBA{R: 0x00, G: 0x00, B: 0x00, A: 0x5b}, // Adwaita color name @shade_color
theme.ColorNameSuccess: color.NRGBA{R: 0x26, G: 0xa2, B: 0x69, A: 0xff}, // Adwaita color name @success_bg_color
theme.ColorNameWarning: color.NRGBA{R: 0xcd, G: 0x93, B: 0x09, A: 0xff}, // Adwaita color name @warning_bg_color
theme.ColorOrange: color.NRGBA{R: 0xff, G: 0x78, B: 0x00, A: 0xff}, // Adwaita color name @orange_3
theme.ColorPurple: color.NRGBA{R: 0x91, G: 0x41, B: 0xac, A: 0xff}, // Adwaita color name @purple_3
theme.ColorRed: color.NRGBA{R: 0xc0, G: 0x1c, B: 0x28, A: 0xff}, // Adwaita color name @red_4
theme.ColorYellow: color.NRGBA{R: 0xf6, G: 0xd3, B: 0x2d, A: 0xff}, // Adwaita color name @yellow_3
}

var adwaitaLightScheme = map[fyne.ThemeColorName]color.Color{
theme.ColorBlue: color.RGBA{0x35, 0x84, 0xe4, 0xff}, // Adwaita color name @blue_3
theme.ColorBrown: color.RGBA{0x98, 0x6a, 0x44, 0xff}, // Adwaita color name @brown_3
theme.ColorGray: color.RGBA{0x5e, 0x5c, 0x64, 0xff}, // Adwaita color name @dark_2
theme.ColorGreen: color.RGBA{0x2e, 0xc2, 0x7e, 0xff}, // Adwaita color name @green_4
theme.ColorNameBackground: color.RGBA{0xfa, 0xfa, 0xfa, 0xff}, // Adwaita color name @window_bg_color
theme.ColorNameButton: color.RGBA{0xeb, 0xeb, 0xeb, 0xff}, // Adwaita color name @headerbar_bg_color
theme.ColorNameError: color.RGBA{0xe0, 0x1b, 0x24, 0xff}, // Adwaita color name @error_bg_color
theme.ColorNameForeground: color.RGBA{0x00, 0x00, 0x00, 0xcc}, // Adwaita color name @window_fg_color
theme.ColorNameInputBackground: color.RGBA{0xff, 0xff, 0xff, 0xff}, // Adwaita color name @view_bg_color
theme.ColorNameMenuBackground: color.RGBA{0xff, 0xff, 0xff, 0xff}, // Adwaita color name @view_bg_color
theme.ColorNameOverlayBackground: color.RGBA{0xff, 0xff, 0xff, 0xff}, // Adwaita color name @view_bg_color
theme.ColorNamePrimary: color.RGBA{0x35, 0x84, 0xe4, 0xff}, // Adwaita color name @accent_bg_color
theme.ColorNameSelection: color.RGBA{0x35, 0x84, 0xe4, 0xff}, // Adwaita color name @accent_bg_color
theme.ColorNameShadow: color.RGBA{0x00, 0x00, 0x00, 0x11}, // Adwaita color name @shade_color
theme.ColorNameSuccess: color.RGBA{0x2e, 0xc2, 0x7e, 0xff}, // Adwaita color name @success_bg_color
theme.ColorNameWarning: color.RGBA{0xe5, 0xa5, 0x0a, 0xff}, // Adwaita color name @warning_bg_color
theme.ColorOrange: color.RGBA{0xff, 0x78, 0x00, 0xff}, // Adwaita color name @orange_3
theme.ColorPurple: color.RGBA{0x91, 0x41, 0xac, 0xff}, // Adwaita color name @purple_3
theme.ColorRed: color.RGBA{0xe0, 0x1b, 0x24, 0xff}, // Adwaita color name @red_3
theme.ColorYellow: color.RGBA{0xf6, 0xd3, 0x2d, 0xff}, // Adwaita color name @yellow_3
theme.ColorBlue: color.NRGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @blue_3
theme.ColorBrown: color.NRGBA{R: 0x98, G: 0x6A, B: 0x44, A: 0xff}, // Adwaita color name @brown_3
theme.ColorGray: color.NRGBA{R: 0x5e, G: 0x5C, B: 0x64, A: 0xff}, // Adwaita color name @dark_2
theme.ColorGreen: color.NRGBA{R: 0x2e, G: 0xC2, B: 0x7e, A: 0xff}, // Adwaita color name @green_4
theme.ColorNameBackground: color.NRGBA{R: 0xfa, G: 0xFA, B: 0xfa, A: 0xff}, // Adwaita color name @window_bg_color
theme.ColorNameButton: color.NRGBA{R: 0xeb, G: 0xEB, B: 0xeb, A: 0xff}, // Adwaita color name @headerbar_bg_color
theme.ColorNameError: color.NRGBA{R: 0xe0, G: 0x1B, B: 0x24, A: 0xff}, // Adwaita color name @error_bg_color
theme.ColorNameForeground: color.NRGBA{R: 0x00, G: 0x00, B: 0x00, A: 0xcc}, // Adwaita color name @window_fg_color
theme.ColorNameInputBackground: color.NRGBA{R: 0xff, G: 0xFF, B: 0xff, A: 0xff}, // Adwaita color name @view_bg_color
theme.ColorNameMenuBackground: color.NRGBA{R: 0xff, G: 0xFF, B: 0xff, A: 0xff}, // Adwaita color name @popover_bg_color
theme.ColorNameOverlayBackground: color.NRGBA{R: 0xff, G: 0xFF, B: 0xff, A: 0xff}, // Adwaita color name @view_bg_color
theme.ColorNamePrimary: color.NRGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_bg_color
theme.ColorNameScrollBar: color.NRGBA{R: 0x00, G: 0x00, B: 0x00, A: 0x5b}, // Adwaita color name @dark_5
theme.ColorNameSelection: color.NRGBA{R: 0xeb, G: 0xEB, B: 0xeb, A: 0xff}, // Adwaita color name @headerbar_bg_color
theme.ColorNameShadow: color.NRGBA{R: 0x00, G: 0x00, B: 0x00, A: 0x11}, // Adwaita color name @shade_color
theme.ColorNameSuccess: color.NRGBA{R: 0x2e, G: 0xC2, B: 0x7e, A: 0xff}, // Adwaita color name @success_bg_color
theme.ColorNameWarning: color.NRGBA{R: 0xe5, G: 0xA5, B: 0x0a, A: 0xff}, // Adwaita color name @warning_bg_color
theme.ColorOrange: color.NRGBA{R: 0xff, G: 0x78, B: 0x00, A: 0xff}, // Adwaita color name @orange_3
theme.ColorPurple: color.NRGBA{R: 0x91, G: 0x41, B: 0xac, A: 0xff}, // Adwaita color name @purple_3
theme.ColorRed: color.NRGBA{R: 0xe0, G: 0x1B, B: 0x24, A: 0xff}, // Adwaita color name @red_3
theme.ColorYellow: color.NRGBA{R: 0xf6, G: 0xD3, B: 0x2d, A: 0xff}, // Adwaita color name @yellow_3
}
243 changes: 0 additions & 243 deletions theme/adwaita_colors_generator.go

This file was deleted.

Loading