-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into diagramwidget
- Loading branch information
Showing
16 changed files
with
914 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package theme | ||
|
||
import ( | ||
"image/color" | ||
|
||
"fyne.io/fyne/v2" | ||
"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 | ||
|
||
var _ fyne.Theme = (*Adwaita)(nil) | ||
|
||
// 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 { | ||
case theme.VariantLight: | ||
if c, ok := adwaitaLightScheme[name]; ok { | ||
return c | ||
} | ||
case theme.VariantDark: | ||
if c, ok := adwaitaDarkScheme[name]; ok { | ||
return c | ||
} | ||
} | ||
return theme.DefaultTheme().Color(name, variant) | ||
} | ||
|
||
// Font returns the named font for the current theme. | ||
func (a *Adwaita) Font(style fyne.TextStyle) fyne.Resource { | ||
return theme.DefaultTheme().Font(style) | ||
} | ||
|
||
// Icon returns the named resource for the current theme. | ||
func (a *Adwaita) Icon(name fyne.ThemeIconName) fyne.Resource { | ||
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 { | ||
return theme.DefaultTheme().Size(name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package theme | ||
|
||
// This file is generated by adwaita_colors_generator.go | ||
// Please do not edit manually, use: | ||
// go generate ./theme/... | ||
// | ||
// The colors are taken from: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.0/named-colors.html | ||
|
||
import ( | ||
"image/color" | ||
|
||
"fyne.io/fyne/v2" | ||
"fyne.io/fyne/v2/theme" | ||
) | ||
|
||
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 | ||
} | ||
|
||
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 | ||
} |
Oops, something went wrong.