From 8310c1d51bb9b0c649d29b221b37427dcbd71073 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Mon, 3 Jul 2023 01:28:12 +0200 Subject: [PATCH 01/12] Bundle Adwaita icons (wip) --- theme/adwaita.go | 3 + theme/adwaita_colors_generator.go | 285 +++++++++++++++++- theme/adwaita_icons.go | 465 ++++++++++++++++++++++++++++++ 3 files changed, 743 insertions(+), 10 deletions(-) create mode 100644 theme/adwaita_icons.go diff --git a/theme/adwaita.go b/theme/adwaita.go index 698224a9..ec714e58 100644 --- a/theme/adwaita.go +++ b/theme/adwaita.go @@ -43,6 +43,9 @@ 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) } diff --git a/theme/adwaita_colors_generator.go b/theme/adwaita_colors_generator.go index 45d2c8f0..d3d1f4ca 100644 --- a/theme/adwaita_colors_generator.go +++ b/theme/adwaita_colors_generator.go @@ -10,23 +10,32 @@ is the name of the color in the Adwaita page without the "@". package main import ( + "archive/tar" "bytes" "fmt" "go/format" "image/color" + "io" "io/ioutil" "log" "net/http" "os" + "path/filepath" "regexp" "strings" "text/template" + + "fyne.io/fyne/v2" ) const ( - adwaitaColorPage = "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.0/named-colors.html" - output = "adwaita_colors.go" - sourceTpl = `package theme + adwaitaColorPage = "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.0/named-colors.html" // the gnome page describing the colors + adwaitaIconsPage = "https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/archive/master/adwaita-icon-theme-master.tar?path=Adwaita" // gitlab page with the icons, tar file here + colorSchemeOutput = "adwaita_colors.go" + iconsOutput = "adwaita_icons.go" + + // the template to generate the color scheme + colorSourceTpl = `package theme // This file is generated by adwaita_colors_generator.go // Please do not edit manually, use: @@ -52,6 +61,30 @@ var adwaitaLightScheme = map[fyne.ThemeColorName]color.Color{ {{$key}}: {{$value.Col}}, // Adwaita color name @{{$value.AdwName}} {{- end }} }` + // the template where to bundle the icons in a map + iconSourceTpl = `package theme + +import ( + "fyne.io/fyne/v2" + "fyne.io/fyne/v2/theme" +) + +var adwaitaIcons = map[fyne.ThemeIconName]fyne.Resource{ +{{range $name, $icon := .Icons}} +{{ if contains $icon.StaticName "symbolic" }} + theme.{{$name}}: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "{{$icon.StaticName}}", + StaticContent: []byte({{ printf "%q" $icon.Content}}), + }), +{{else}} + theme.{{$name}}: &fyne.StaticResource{ + StaticName: "{{$icon.StaticName}}", + StaticContent: []byte({{ printf "%q" $icon.Content}}), + }, +{{end}} +{{end}} +} +` ) var ( @@ -90,6 +123,115 @@ var ( "theme.ColorBrown": "brown_3", "theme.ColorGray": "dark_2", } + + // map to describe the icons to get from the Adwaita gitlab page and the name of the icon in the Fyne theme + iconsToGet = map[string]string{ + "IconNameCancel": "symbolic/ui/window-close-symbolic.svg", + "IconNameConfirm": "symbolic/actions/object-select-symbolic.svg", + "IconNameDelete": "symbolic/places/user-trash-symbolic.svg", + "IconNameSearch": "symbolic/actions/system-search-symbolic.svg", + "IconNameSearchReplace": "symbolic/actions/system-search-symbolic.svg", // to be changed + "IconNameMenu": "symbolic/actions/open-menu-symbolic.svg", + "IconNameMenuExpand": "symbolic/ui/pan-end-symbolic.svg", + + "IconNameCheckButton": "symbolic/ui/checkbox-symbolic.svg", + "IconNameCheckButtonChecked": "symbolic/ui/checkbox-checked-symbolic.svg", + "IconNameRadioButton": "symbolic/ui/radio-symbolic.svg", + "IconNameRadioButtonChecked": "symbolic/ui/radio-checked-symbolic.svg", + + "IconNameContentAdd": "symbolic/actions/list-add-symbolic.svg", + "IconNameContentClear": "symbolic/actions/edit-clear-symbolic.svg", + "IconNameContentRemove": "symbolic/actions/list-remove-symbolic.svg", + "IconNameContentCut": "symbolic/actions/edit-cut-symbolic.svg", + "IconNameContentCopy": "symbolic/actions/edit-copy-symbolic.svg", + "IconNameContentPaste": "symbolic/actions/edit-paste-symbolic.svg", + "IconNameContentRedo": "symbolic/actions/edit-redo-symbolic.svg", + "IconNameContentUndo": "symbolic/actions/edit-undo-symbolic.svg", + + "IconNameColorAchromatic": "", + "IconNameColorChromatic": "", + "IconNameColorPalette": "", + + "IconNameDocument": "symbolic/mimetypes/text-x-generic-symbolic.svg", + "IconNameDocumentCreate": "symbolic/actions/document-new-symbolic.svg", + "IconNameDocumentPrint": "symbolic/actions/document-print-symbolic.svg", + "IconNameDocumentSave": "symbolic/actions/document-save-symbolic.svg", + + "IconNameMoreHorizontal": "symbolic/actions/view-more-horizontal-symbolic.svg", + "IconNameMoreVertical": "symbolic/actions/view-more-symbolic.svg", + + "IconNameInfo": "symbolic/status/dialog-information-symbolic.svg", + "IconNameQuestion": "symbolic/status/dialog-question-symbolic.svg", + "IconNameWarning": "symbolic/status/dialog-warning-symbolic.svg", + "IconNameError": "symbolic/status/dialog-error-symbolic.svg", + + "IconNameMailAttachment": "", + "IconNameMailCompose": "", + "IconNameMailForward": "", + "IconNameMailReply": "", + "IconNameMailReplyAll": "", + "IconNameMailSend": "", + + "IconNameMediaMusic": "symbolic/mimetypes/audio-x-generic-symbolic.svg", + "IconNameMediaPhoto": "symbolic/mimetypes/image-x-generic-symbolic.svg", + "IconNameMediaVideo": "symbolic/mimetypes/video-x-generic-symbolic.svg", + "IconNameMediaFastForward": "symbolic/actions/media-seek-forward-symbolic.svg", + "IconNameMediaFastRewind": "symbolic/actions/media-seek-backward-symbolic.svg", + "IconNameMediaPause": "symbolic/actions/media-playback-pause-symbolic.svg", + "IconNameMediaPlay": "symbolic/actions/media-playback-start-symbolic.svg", + "IconNameMediaRecord": "symbolic/actions/media-record-symbolic.svg", + "IconNameMediaReplay": "symbolic/actions/media-seek-backward-symbolic.svg", + "IconNameMediaSkipNext": "symbolic/actions/media-skip-forward-symbolic.svg", + "IconNameMediaSkipPrevious": "symbolic/actions/media-skip-backward-symbolic.svg", + "IconNameMediaStop": "symbolic/actions/media-playback-stop-symbolic.svg", + + "IconNameNavigateBack": "symbolic/actions/go-previous-symbolic.svg", + "IconNameMoveDown": "symbolic/actions/go-down-symbolic.svg", + "IconNameNavigateNext": "symbolic/actions/go-next-symbolic.svg", + "IconNameMoveUp": "symbolic/actions/go-up-symbolic.svg", + "IconNameArrowDropDown": "symbolic/actions/go-down-symbolic.svg", + "IconNameArrowDropUp": "symbolic/actions/go-up-symbolic.svg", + + "IconNameFile": "", + "IconNameFileApplication": "scalable/mimetypes/application-x-executable.svg", + "IconNameFileAudio": "scalable/mimetypes/audio-x-generic.svg", + "IconNameFileImage": "scalable/mimetypes/image-x-generic.svg", + "IconNameFileText": "scalable/mimetypes/text-x-generic.svg", + "IconNameFileVideo": "scalable/mimetypes/video-x-generic.svg", + "IconNameFolder": "scalable/places/folder.svg", + "IconNameFolderNew": "symbolic/actions/folder-new-symbolic.svg", + "IconNameFolderOpen": "symbolic/status/folder-open-symbolic.svg", + "IconNameHelp": "symbolic/actions/help-about-symbolic.svg", + "IconNameHistory": "", + "IconNameHome": "symbolic/places/user-home-symbolic.svg", + "IconNameSettings": "symbolic/categories/applications-system-symbolic.svg", + + "IconNameViewFullScreen": "", + "IconNameViewRefresh": "", + "IconNameViewRestore": "", + "IconNameViewZoomFit": "", + "IconNameViewZoomIn": "", + "IconNameViewZoomOut": "", + + "IconNameVisibility": "", + "IconNameVisibilityOff": "", + + "IconNameVolumeDown": "", + "IconNameVolumeMute": "", + "IconNameVolumeUp": "", + + "IconNameDownload": "symbolic/places/folder-download-symbolic.svg", + "IconNameComputer": "symbolic/devices/computer-symbolic.svg", + "IconNameStorage": "symbolic/devices/drive-harddisk-symbolic.svg", + "IconNameUpload": "symbolic/actions/send-to-symbolic.svg", + + "IconNameAccount": "symbolic/status/avatar-default-symbolic.svg", + "IconNameLogin": "", + "IconNameLogout": "", + + "IconNameList": "symbolic/actions/view-list-symbolic.svg", + "IconNameGrid": "symbolic/actions/view-grid-symbolic.svg", + } ) type colorInfo struct { @@ -97,20 +239,142 @@ type colorInfo struct { AdwName string // Adwaita color name from the documentation without the "@" } +type iconInfo struct { + StaticName string // the theme name of the icon for Fyne + Content string // the content of the icon, SVG content +} + func main() { + if err := generateColorScheme(); err != nil { + log.Fatal(err) + } + + if err := generateIcons(); err != nil { + log.Fatal(err) + } + +} + +// generateIcons generates the icons file from the Adwaita icon theme. It downloads the theme from the gitlab repository +// as a tar file and extracts it in a temporary directory. +// Then, using the icons map, it get the corresponding icon and generate the go file. +func generateIcons() error { + + // get https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/archive/master/adwaita-icon-theme-master.tar?path=Adwaita as a tar file and extract it in memory + resp, err := http.Get(adwaitaIconsPage) + if err != nil { + return err + } + defer resp.Body.Close() + tarReader := tar.NewReader(resp.Body) + + // extract in a temporary directory + tmpDir, err := ioutil.TempDir("", "adwaita") + if err != nil { + return err + } + defer os.RemoveAll(tmpDir) + for { + header, err := tarReader.Next() + if err == io.EOF { + break + } + if err != nil { + return err + + } + if header.Typeflag == tar.TypeReg { + target := filepath.Join(tmpDir, header.Name) + if err := os.MkdirAll(filepath.Dir(target), 0755); err != nil { + return err + } + file, err := os.Create(target) + if err != nil { + return err + } + defer file.Close() + if _, err := io.Copy(file, tarReader); err != nil { + return err + } + } + } + + icons := map[string]iconInfo{} + for name, iconfile := range iconsToGet { + if iconfile == "" { + continue + } + res, err := fyne.LoadResourceFromPath(filepath.Join(tmpDir, "adwaita-icon-theme-master-Adwaita", "Adwaita", iconfile)) + if err != nil { + log.Println("Error bundeling", name, "from", iconfile, ":", err) + continue + } + + filecontent := res.Content() + //// replace fill= to fill=none on the firts path + //if strings.Contains(file, "symbolic") { + // filecontent = regexp.MustCompile(`fill="[^"]*"`).ReplaceAll(filecontent, []byte(`fill="#000000"`)) + //} + icons[name] = struct { + StaticName string + Content string + }{ + StaticName: filepath.Base(iconfile), + Content: string(filecontent), + } + } + + tpl := template.New("source") + tpl = tpl.Funcs(template.FuncMap{ + "contains": strings.Contains, + }) + tpl, err = tpl.Parse(iconSourceTpl) + if err != nil { + return fmt.Errorf("Error parsing template: %w", err) + } + // generate the source + buffer := bytes.NewBuffer(nil) + err = tpl.Execute(buffer, struct { + Icons map[string]iconInfo + }{ + Icons: icons, + }) + if err != nil { + log.Fatal(err) + } + + result := buffer.Bytes() + + //result, err = format.Source(result) + //if err != nil { + // return fmt.Errorf("error formatting source: %w", err) + //} + + err = ioutil.WriteFile(iconsOutput, result, 0644) + if err != nil { + return fmt.Errorf("error writing source: %w\n%s", err, string(iconSourceTpl)) + } + return nil +} + +// generateColorScheme generates the color scheme file from the Adwaita documentation. It downloads the documentation +// page and parse it to get the color scheme. Following the documentation and recommendations, it generates the light and dark +// color schemes. +func generateColorScheme() error { + rows := [][]string{} darkScheme := map[string]colorInfo{} lightScheme := map[string]colorInfo{} reps, err := http.Get(adwaitaColorPage) if err != nil { - log.Fatal(err) + return fmt.Errorf("failed to get page: %w", err) } defer reps.Body.Close() htpage, err := ioutil.ReadAll(reps.Body) if err != nil { - log.Fatal(err) + return fmt.Errorf("failed to read body: %w", err) } // find all the rows in the tables rows = tableRowMatcher.FindAllStringSubmatch(string(htpage), -1) @@ -193,16 +457,16 @@ func main() { } } - out, err := os.Create(output) + out, err := os.Create(colorSchemeOutput) if err != nil { - log.Fatal(err) + return fmt.Errorf("failed to create output file: %w", err) } defer out.Close() tpl := template.New("source") - tpl, err = tpl.Parse(sourceTpl) + tpl, err = tpl.Parse(colorSourceTpl) if err != nil { - log.Fatal(err) + return fmt.Errorf("failed to parse template: %w", err) } // generate the source buffer := bytes.NewBuffer(nil) @@ -223,9 +487,10 @@ func main() { } else { out.Write(formatted) } - + return nil } +// stringToColor converts a string to a color.RGBA func stringToColor(s string) (c color.RGBA, err error) { c.A = 0xff switch len(s) { diff --git a/theme/adwaita_icons.go b/theme/adwaita_icons.go new file mode 100644 index 00000000..72c06f5c --- /dev/null +++ b/theme/adwaita_icons.go @@ -0,0 +1,465 @@ +package theme + +import ( + "fyne.io/fyne/v2" + "fyne.io/fyne/v2/theme" +) + +var adwaitaIcons = map[fyne.ThemeIconName]fyne.Resource{ + + + theme.IconNameAccount: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "avatar-default-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameArrowDropDown: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "go-down-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameArrowDropUp: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "go-up-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameCancel: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "window-close-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameCheckButton: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "checkbox-symbolic.svg", + StaticContent: []byte("\n\n\n\n\n\n"), + }), + + + + theme.IconNameCheckButtonChecked: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "checkbox-checked-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameComputer: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "computer-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameConfirm: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "object-select-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameContentAdd: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "list-add-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameContentClear: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "edit-clear-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameContentCopy: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "edit-copy-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameContentCut: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "edit-cut-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameContentPaste: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "edit-paste-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameContentRedo: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "edit-redo-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameContentRemove: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "list-remove-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameContentUndo: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "edit-undo-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameDelete: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "user-trash-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n\n"), + }), + + + + theme.IconNameDocument: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "text-x-generic-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameDocumentCreate: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "document-new-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameDocumentPrint: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "document-print-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameDocumentSave: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "document-save-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameDownload: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "folder-download-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameError: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "dialog-error-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameFileApplication: &fyne.StaticResource{ + StaticName: "application-x-executable.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"), + }, + + + + theme.IconNameFileAudio: &fyne.StaticResource{ + StaticName: "audio-x-generic.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"), + }, + + + + theme.IconNameFileImage: &fyne.StaticResource{ + StaticName: "image-x-generic.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n\n"), + }, + + + + theme.IconNameFileText: &fyne.StaticResource{ + StaticName: "text-x-generic.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"), + }, + + + + theme.IconNameFileVideo: &fyne.StaticResource{ + StaticName: "video-x-generic.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n\n"), + }, + + + + theme.IconNameFolder: &fyne.StaticResource{ + StaticName: "folder.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n\n"), + }, + + + + theme.IconNameFolderNew: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "folder-new-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameFolderOpen: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "folder-open-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + + + theme.IconNameGrid: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "view-grid-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameHelp: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "help-about-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameHome: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "user-home-symbolic.svg", + StaticContent: []byte("\n\n \n \n\n"), + }), + + + + theme.IconNameInfo: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "dialog-information-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + + + theme.IconNameList: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "view-list-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameMediaFastForward: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-seek-forward-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + + + theme.IconNameMediaFastRewind: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-seek-backward-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + + + theme.IconNameMediaMusic: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "audio-x-generic-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameMediaPause: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-playback-pause-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + + + theme.IconNameMediaPhoto: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "image-x-generic-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + + + theme.IconNameMediaPlay: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-playback-start-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameMediaRecord: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-record-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameMediaReplay: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-seek-backward-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + + + theme.IconNameMediaSkipNext: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-skip-forward-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + + + theme.IconNameMediaSkipPrevious: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-skip-backward-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + + + theme.IconNameMediaStop: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-playback-stop-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameMediaVideo: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "video-x-generic-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + + + theme.IconNameMenu: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "open-menu-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n \n\n"), + }), + + + + theme.IconNameMenuExpand: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "pan-end-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameMoreHorizontal: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "view-more-horizontal-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameMoreVertical: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "view-more-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameMoveDown: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "go-down-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameMoveUp: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "go-up-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameNavigateBack: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "go-previous-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameNavigateNext: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "go-next-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameQuestion: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "dialog-question-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameRadioButton: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "radio-symbolic.svg", + StaticContent: []byte("\n\n\n\n\n\n"), + }), + + + + theme.IconNameRadioButtonChecked: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "radio-checked-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameSearch: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "system-search-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameSearchReplace: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "system-search-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameSettings: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "applications-system-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameStorage: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "drive-harddisk-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameUpload: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "send-to-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + + + theme.IconNameWarning: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "dialog-warning-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + +} From 2ebaeb035d94f3ffab1b436977fde1c0a31f93f4 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Mon, 3 Jul 2023 01:30:38 +0200 Subject: [PATCH 02/12] Renamed generator and use goreorder --- theme/adwaita.go | 10 +- theme/adwaita_colors.go | 1 - theme/adwaita_icons.go | 783 ++++++++---------- ...enerator.go => adwaita_theme_generator.go} | 205 +++-- 4 files changed, 433 insertions(+), 566 deletions(-) rename theme/{adwaita_colors_generator.go => adwaita_theme_generator.go} (99%) diff --git a/theme/adwaita.go b/theme/adwaita.go index ec714e58..2be114f0 100644 --- a/theme/adwaita.go +++ b/theme/adwaita.go @@ -8,19 +8,19 @@ import ( ) // 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. +// 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 { diff --git a/theme/adwaita_colors.go b/theme/adwaita_colors.go index 4030e0e9..42f44aea 100644 --- a/theme/adwaita_colors.go +++ b/theme/adwaita_colors.go @@ -35,7 +35,6 @@ var adwaitaDarkScheme = map[fyne.ThemeColorName]color.Color{ 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 diff --git a/theme/adwaita_icons.go b/theme/adwaita_icons.go index 72c06f5c..de0bbf29 100644 --- a/theme/adwaita_icons.go +++ b/theme/adwaita_icons.go @@ -1,465 +1,334 @@ package theme import ( - "fyne.io/fyne/v2" - "fyne.io/fyne/v2/theme" + "fyne.io/fyne/v2" + "fyne.io/fyne/v2/theme" ) var adwaitaIcons = map[fyne.ThemeIconName]fyne.Resource{ - - theme.IconNameAccount: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "avatar-default-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameArrowDropDown: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "go-down-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameArrowDropUp: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "go-up-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameCancel: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "window-close-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameCheckButton: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "checkbox-symbolic.svg", - StaticContent: []byte("\n\n\n\n\n\n"), - }), - - - - theme.IconNameCheckButtonChecked: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "checkbox-checked-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameComputer: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "computer-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameConfirm: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "object-select-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameContentAdd: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "list-add-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameContentClear: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "edit-clear-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameContentCopy: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "edit-copy-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameContentCut: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "edit-cut-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameContentPaste: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "edit-paste-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameContentRedo: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "edit-redo-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameContentRemove: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "list-remove-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameContentUndo: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "edit-undo-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameDelete: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "user-trash-symbolic.svg", - StaticContent: []byte("\n\n \n \n \n \n \n \n \n\n"), - }), - - - - theme.IconNameDocument: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "text-x-generic-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameDocumentCreate: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "document-new-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameDocumentPrint: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "document-print-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameDocumentSave: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "document-save-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameDownload: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "folder-download-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameError: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "dialog-error-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameFileApplication: &fyne.StaticResource{ - StaticName: "application-x-executable.svg", - StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"), - }, - - - - theme.IconNameFileAudio: &fyne.StaticResource{ - StaticName: "audio-x-generic.svg", - StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"), - }, - - - - theme.IconNameFileImage: &fyne.StaticResource{ - StaticName: "image-x-generic.svg", - StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n\n"), - }, - - - - theme.IconNameFileText: &fyne.StaticResource{ - StaticName: "text-x-generic.svg", - StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"), - }, - - - - theme.IconNameFileVideo: &fyne.StaticResource{ - StaticName: "video-x-generic.svg", - StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n\n"), - }, - - - - theme.IconNameFolder: &fyne.StaticResource{ - StaticName: "folder.svg", - StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n\n"), - }, - - - - theme.IconNameFolderNew: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "folder-new-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameFolderOpen: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "folder-open-symbolic.svg", - StaticContent: []byte("\n\n \n \n \n \n\n"), - }), - - - - theme.IconNameGrid: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "view-grid-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameHelp: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "help-about-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameHome: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "user-home-symbolic.svg", - StaticContent: []byte("\n\n \n \n\n"), - }), - - - - theme.IconNameInfo: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "dialog-information-symbolic.svg", - StaticContent: []byte("\n\n \n \n \n \n\n"), - }), - - - - theme.IconNameList: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "view-list-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameMediaFastForward: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "media-seek-forward-symbolic.svg", - StaticContent: []byte("\n\n \n \n \n \n\n"), - }), - - - - theme.IconNameMediaFastRewind: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "media-seek-backward-symbolic.svg", - StaticContent: []byte("\n\n \n \n \n \n\n"), - }), - - - - theme.IconNameMediaMusic: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "audio-x-generic-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameMediaPause: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "media-playback-pause-symbolic.svg", - StaticContent: []byte("\n\n \n \n \n \n\n"), - }), - - - - theme.IconNameMediaPhoto: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "image-x-generic-symbolic.svg", - StaticContent: []byte("\n\n \n \n \n \n\n"), - }), - - - - theme.IconNameMediaPlay: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "media-playback-start-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameMediaRecord: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "media-record-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameMediaReplay: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "media-seek-backward-symbolic.svg", - StaticContent: []byte("\n\n \n \n \n \n\n"), - }), - - - - theme.IconNameMediaSkipNext: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "media-skip-forward-symbolic.svg", - StaticContent: []byte("\n\n \n \n \n \n\n"), - }), - - - - theme.IconNameMediaSkipPrevious: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "media-skip-backward-symbolic.svg", - StaticContent: []byte("\n\n \n \n \n \n\n"), - }), - - - - theme.IconNameMediaStop: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "media-playback-stop-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameMediaVideo: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "video-x-generic-symbolic.svg", - StaticContent: []byte("\n\n \n \n \n \n\n"), - }), - - - - theme.IconNameMenu: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "open-menu-symbolic.svg", - StaticContent: []byte("\n\n \n \n \n \n \n\n"), - }), - - - - theme.IconNameMenuExpand: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "pan-end-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameMoreHorizontal: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "view-more-horizontal-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameMoreVertical: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "view-more-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameMoveDown: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "go-down-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameMoveUp: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "go-up-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameNavigateBack: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "go-previous-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameNavigateNext: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "go-next-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameQuestion: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "dialog-question-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameRadioButton: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "radio-symbolic.svg", - StaticContent: []byte("\n\n\n\n\n\n"), - }), - - - - theme.IconNameRadioButtonChecked: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "radio-checked-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameSearch: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "system-search-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameSearchReplace: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "system-search-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameSettings: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "applications-system-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameStorage: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "drive-harddisk-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameUpload: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "send-to-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - - - theme.IconNameWarning: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "dialog-warning-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - - + theme.IconNameAccount: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "avatar-default-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameArrowDropDown: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "go-down-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameArrowDropUp: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "go-up-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameCancel: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "window-close-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameCheckButton: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "checkbox-symbolic.svg", + StaticContent: []byte("\n\n\n\n\n\n"), + }), + + theme.IconNameCheckButtonChecked: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "checkbox-checked-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameComputer: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "computer-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameConfirm: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "object-select-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameContentAdd: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "list-add-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameContentClear: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "edit-clear-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameContentCopy: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "edit-copy-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameContentCut: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "edit-cut-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameContentPaste: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "edit-paste-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameContentRedo: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "edit-redo-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameContentRemove: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "list-remove-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameContentUndo: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "edit-undo-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameDelete: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "user-trash-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n\n"), + }), + + theme.IconNameDocument: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "text-x-generic-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameDocumentCreate: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "document-new-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameDocumentPrint: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "document-print-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameDocumentSave: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "document-save-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameDownload: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "folder-download-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameError: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "dialog-error-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameFileApplication: &fyne.StaticResource{ + StaticName: "application-x-executable.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"), + }, + + theme.IconNameFileAudio: &fyne.StaticResource{ + StaticName: "audio-x-generic.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"), + }, + + theme.IconNameFileImage: &fyne.StaticResource{ + StaticName: "image-x-generic.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n\n"), + }, + + theme.IconNameFileText: &fyne.StaticResource{ + StaticName: "text-x-generic.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"), + }, + + theme.IconNameFileVideo: &fyne.StaticResource{ + StaticName: "video-x-generic.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n\n"), + }, + + theme.IconNameFolder: &fyne.StaticResource{ + StaticName: "folder.svg", + StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n\n"), + }, + + theme.IconNameFolderNew: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "folder-new-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameFolderOpen: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "folder-open-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameGrid: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "view-grid-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameHelp: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "help-about-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameHome: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "user-home-symbolic.svg", + StaticContent: []byte("\n\n \n \n\n"), + }), + + theme.IconNameInfo: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "dialog-information-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameList: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "view-list-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMediaFastForward: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-seek-forward-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameMediaFastRewind: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-seek-backward-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameMediaMusic: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "audio-x-generic-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMediaPause: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-playback-pause-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameMediaPhoto: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "image-x-generic-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameMediaPlay: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-playback-start-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMediaRecord: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-record-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMediaReplay: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-seek-backward-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameMediaSkipNext: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-skip-forward-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameMediaSkipPrevious: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-skip-backward-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameMediaStop: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "media-playback-stop-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMediaVideo: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "video-x-generic-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameMenu: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "open-menu-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n \n\n"), + }), + + theme.IconNameMenuExpand: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "pan-end-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMoreHorizontal: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "view-more-horizontal-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMoreVertical: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "view-more-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMoveDown: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "go-down-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMoveUp: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "go-up-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameNavigateBack: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "go-previous-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameNavigateNext: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "go-next-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameQuestion: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "dialog-question-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameRadioButton: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "radio-symbolic.svg", + StaticContent: []byte("\n\n\n\n\n\n"), + }), + + theme.IconNameRadioButtonChecked: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "radio-checked-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameSearch: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "system-search-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameSearchReplace: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "system-search-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameSettings: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "applications-system-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameStorage: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "drive-harddisk-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameUpload: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "send-to-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameWarning: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "dialog-warning-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), } diff --git a/theme/adwaita_colors_generator.go b/theme/adwaita_theme_generator.go similarity index 99% rename from theme/adwaita_colors_generator.go rename to theme/adwaita_theme_generator.go index d3d1f4ca..362831d4 100644 --- a/theme/adwaita_colors_generator.go +++ b/theme/adwaita_theme_generator.go @@ -238,7 +238,6 @@ type colorInfo struct { Col string // go formated color (color.RGBA{0x00, 0x00, 0x00, 0x00}) AdwName string // Adwaita color name from the documentation without the "@" } - type iconInfo struct { StaticName string // the theme name of the icon for Fyne Content string // the content of the icon, SVG content @@ -256,108 +255,6 @@ func main() { } -// generateIcons generates the icons file from the Adwaita icon theme. It downloads the theme from the gitlab repository -// as a tar file and extracts it in a temporary directory. -// Then, using the icons map, it get the corresponding icon and generate the go file. -func generateIcons() error { - - // get https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/archive/master/adwaita-icon-theme-master.tar?path=Adwaita as a tar file and extract it in memory - resp, err := http.Get(adwaitaIconsPage) - if err != nil { - return err - } - defer resp.Body.Close() - tarReader := tar.NewReader(resp.Body) - - // extract in a temporary directory - tmpDir, err := ioutil.TempDir("", "adwaita") - if err != nil { - return err - } - defer os.RemoveAll(tmpDir) - for { - header, err := tarReader.Next() - if err == io.EOF { - break - } - if err != nil { - return err - - } - if header.Typeflag == tar.TypeReg { - target := filepath.Join(tmpDir, header.Name) - if err := os.MkdirAll(filepath.Dir(target), 0755); err != nil { - return err - } - file, err := os.Create(target) - if err != nil { - return err - } - defer file.Close() - if _, err := io.Copy(file, tarReader); err != nil { - return err - } - } - } - - icons := map[string]iconInfo{} - for name, iconfile := range iconsToGet { - if iconfile == "" { - continue - } - res, err := fyne.LoadResourceFromPath(filepath.Join(tmpDir, "adwaita-icon-theme-master-Adwaita", "Adwaita", iconfile)) - if err != nil { - log.Println("Error bundeling", name, "from", iconfile, ":", err) - continue - } - - filecontent := res.Content() - //// replace fill= to fill=none on the firts path - //if strings.Contains(file, "symbolic") { - // filecontent = regexp.MustCompile(`fill="[^"]*"`).ReplaceAll(filecontent, []byte(`fill="#000000"`)) - //} - icons[name] = struct { - StaticName string - Content string - }{ - StaticName: filepath.Base(iconfile), - Content: string(filecontent), - } - } - - tpl := template.New("source") - tpl = tpl.Funcs(template.FuncMap{ - "contains": strings.Contains, - }) - tpl, err = tpl.Parse(iconSourceTpl) - if err != nil { - return fmt.Errorf("Error parsing template: %w", err) - } - // generate the source - buffer := bytes.NewBuffer(nil) - err = tpl.Execute(buffer, struct { - Icons map[string]iconInfo - }{ - Icons: icons, - }) - if err != nil { - log.Fatal(err) - } - - result := buffer.Bytes() - - //result, err = format.Source(result) - //if err != nil { - // return fmt.Errorf("error formatting source: %w", err) - //} - - err = ioutil.WriteFile(iconsOutput, result, 0644) - if err != nil { - return fmt.Errorf("error writing source: %w\n%s", err, string(iconSourceTpl)) - } - return nil -} - // generateColorScheme generates the color scheme file from the Adwaita documentation. It downloads the documentation // page and parse it to get the color scheme. Following the documentation and recommendations, it generates the light and dark // color schemes. @@ -506,3 +403,105 @@ func stringToColor(s string) (c color.RGBA, err error) { } return } + +// generateIcons generates the icons file from the Adwaita icon theme. It downloads the theme from the gitlab repository +// as a tar file and extracts it in a temporary directory. +// Then, using the icons map, it get the corresponding icon and generate the go file. +func generateIcons() error { + + // get https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/archive/master/adwaita-icon-theme-master.tar?path=Adwaita as a tar file and extract it in memory + resp, err := http.Get(adwaitaIconsPage) + if err != nil { + return err + } + defer resp.Body.Close() + tarReader := tar.NewReader(resp.Body) + + // extract in a temporary directory + tmpDir, err := ioutil.TempDir("", "adwaita") + if err != nil { + return err + } + defer os.RemoveAll(tmpDir) + for { + header, err := tarReader.Next() + if err == io.EOF { + break + } + if err != nil { + return err + + } + if header.Typeflag == tar.TypeReg { + target := filepath.Join(tmpDir, header.Name) + if err := os.MkdirAll(filepath.Dir(target), 0755); err != nil { + return err + } + file, err := os.Create(target) + if err != nil { + return err + } + defer file.Close() + if _, err := io.Copy(file, tarReader); err != nil { + return err + } + } + } + + icons := map[string]iconInfo{} + for name, iconfile := range iconsToGet { + if iconfile == "" { + continue + } + res, err := fyne.LoadResourceFromPath(filepath.Join(tmpDir, "adwaita-icon-theme-master-Adwaita", "Adwaita", iconfile)) + if err != nil { + log.Println("Error bundeling", name, "from", iconfile, ":", err) + continue + } + + filecontent := res.Content() + //// replace fill= to fill=none on the firts path + //if strings.Contains(file, "symbolic") { + // filecontent = regexp.MustCompile(`fill="[^"]*"`).ReplaceAll(filecontent, []byte(`fill="#000000"`)) + //} + icons[name] = struct { + StaticName string + Content string + }{ + StaticName: filepath.Base(iconfile), + Content: string(filecontent), + } + } + + tpl := template.New("source") + tpl = tpl.Funcs(template.FuncMap{ + "contains": strings.Contains, + }) + tpl, err = tpl.Parse(iconSourceTpl) + if err != nil { + return fmt.Errorf("Error parsing template: %w", err) + } + // generate the source + buffer := bytes.NewBuffer(nil) + err = tpl.Execute(buffer, struct { + Icons map[string]iconInfo + }{ + Icons: icons, + }) + if err != nil { + log.Fatal(err) + } + + result := buffer.Bytes() + + //result, err = format.Source(result) + //if err != nil { + // return fmt.Errorf("error formatting source: %w", err) + //} + + err = ioutil.WriteFile(iconsOutput, result, 0644) + if err != nil { + return fmt.Errorf("error writing source: %w\n%s", err, string(iconSourceTpl)) + } + return nil +} From 31c30265cea5978cab8db1aa2d18fd63680e7b1b Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Mon, 3 Jul 2023 01:40:03 +0200 Subject: [PATCH 03/12] Cleanup code, better doc --- theme/adwaita_colors.go | 1 + theme/adwaita_theme_generator.go | 80 ++++++++++++-------------------- 2 files changed, 31 insertions(+), 50 deletions(-) diff --git a/theme/adwaita_colors.go b/theme/adwaita_colors.go index 42f44aea..4030e0e9 100644 --- a/theme/adwaita_colors.go +++ b/theme/adwaita_colors.go @@ -35,6 +35,7 @@ var adwaitaDarkScheme = map[fyne.ThemeColorName]color.Color{ 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 diff --git a/theme/adwaita_theme_generator.go b/theme/adwaita_theme_generator.go index 362831d4..9bb7ee2f 100644 --- a/theme/adwaita_theme_generator.go +++ b/theme/adwaita_theme_generator.go @@ -311,11 +311,11 @@ func generateColorScheme() error { for colname, color := range colorToGet { lcol, err := getWidgetColorFor(color, "light") if err != nil { - log.Fatal(err) + return fmt.Errorf("failed to get light color for %s: %w", color, err) } dcol, err := getWidgetColorFor(color, "dark") if err != nil { - log.Fatal(err) + return fmt.Errorf("failed to get dark color for %s: %w", color, err) } lightScheme[colname] = colorInfo{ Col: fmt.Sprintf("color.RGBA{0x%02x, 0x%02x, 0x%02x, 0x%02x}", lcol.R, lcol.G, lcol.B, lcol.A), @@ -338,11 +338,11 @@ func generateColorScheme() error { lcol, err := getStandardColorFor(lightColorName) if err != nil { - log.Fatal(err) + return fmt.Errorf("failed to get light color for %s: %w", lightColorName, err) } dcol, err := getStandardColorFor(darkColorName) if err != nil { - log.Fatal(err) + return fmt.Errorf("failed to get dark color for %s: %w", darkColorName, err) } lightScheme[colname] = colorInfo{ Col: fmt.Sprintf("color.RGBA{0x%02x, 0x%02x, 0x%02x, 0x%02x}", lcol.R, lcol.G, lcol.B, lcol.A), @@ -354,12 +354,6 @@ func generateColorScheme() error { } } - out, err := os.Create(colorSchemeOutput) - if err != nil { - return fmt.Errorf("failed to create output file: %w", err) - } - defer out.Close() - tpl := template.New("source") tpl, err = tpl.Parse(colorSourceTpl) if err != nil { @@ -375,33 +369,15 @@ func generateColorScheme() error { DarkScheme: darkScheme, }) if err != nil { - log.Fatal(err) + return fmt.Errorf("failed to execute template: %w", err) } // format the file if formatted, err := format.Source(buffer.Bytes()); err != nil { - log.Fatal(err) + return fmt.Errorf("failed to format source: %w", err) } else { - out.Write(formatted) - } - return nil -} - -// stringToColor converts a string to a color.RGBA -func stringToColor(s string) (c color.RGBA, err error) { - c.A = 0xff - switch len(s) { - case 7: - _, err = fmt.Sscanf(s, "#%02x%02x%02x", &c.R, &c.G, &c.B) - case 9: - _, err = fmt.Sscanf(s, "#%02x%02x%02x%02x", &c.R, &c.G, &c.B, &c.A) - default: - // rgba(...) format - var a float32 - _, err = fmt.Sscanf(s, "rgba(%d, %d, %d, %f)", &c.R, &c.G, &c.B, &a) - c.A = uint8(a * 255) + return ioutil.WriteFile(colorSchemeOutput, formatted, 0644) } - return } // generateIcons generates the icons file from the Adwaita icon theme. It downloads the theme from the gitlab repository @@ -460,14 +436,8 @@ func generateIcons() error { } filecontent := res.Content() - //// replace fill= to fill=none on the firts path - //if strings.Contains(file, "symbolic") { - // filecontent = regexp.MustCompile(`fill="[^"]*"`).ReplaceAll(filecontent, []byte(`fill="#000000"`)) - //} - icons[name] = struct { - StaticName string - Content string - }{ + + icons[name] = iconInfo{ StaticName: filepath.Base(iconfile), Content: string(filecontent), } @@ -489,19 +459,29 @@ func generateIcons() error { Icons: icons, }) if err != nil { - log.Fatal(err) + return fmt.Errorf("Error executing template: %w", err) } - result := buffer.Bytes() - - //result, err = format.Source(result) - //if err != nil { - // return fmt.Errorf("error formatting source: %w", err) - //} + if formatted, err := format.Source(buffer.Bytes()); err != nil { + return fmt.Errorf("error formatting source: %w", err) + } else { + return ioutil.WriteFile(iconsOutput, formatted, 0644) + } +} - err = ioutil.WriteFile(iconsOutput, result, 0644) - if err != nil { - return fmt.Errorf("error writing source: %w\n%s", err, string(iconSourceTpl)) +// stringToColor converts a string to a color.RGBA +func stringToColor(s string) (c color.RGBA, err error) { + c.A = 0xff + switch len(s) { + case 7: + _, err = fmt.Sscanf(s, "#%02x%02x%02x", &c.R, &c.G, &c.B) + case 9: + _, err = fmt.Sscanf(s, "#%02x%02x%02x%02x", &c.R, &c.G, &c.B, &c.A) + default: + // rgba(...) format + var a float32 + _, err = fmt.Sscanf(s, "rgba(%d, %d, %d, %f)", &c.R, &c.G, &c.B, &a) + c.A = uint8(a * 255) } - return nil + return } From 91a3aa277a17b7db0dbff134818b2cf08dbc6f44 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Mon, 3 Jul 2023 01:44:41 +0200 Subject: [PATCH 04/12] More information about not defined Icons Not defined icons are set to the default. I don't have listed everything yet. --- theme/adwaita_icons.go | 5 ----- theme/adwaita_theme_generator.go | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/theme/adwaita_icons.go b/theme/adwaita_icons.go index de0bbf29..fadb6084 100644 --- a/theme/adwaita_icons.go +++ b/theme/adwaita_icons.go @@ -307,11 +307,6 @@ var adwaitaIcons = map[fyne.ThemeIconName]fyne.Resource{ StaticContent: []byte("\n\n \n\n"), }), - theme.IconNameSearchReplace: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "system-search-symbolic.svg", - StaticContent: []byte("\n\n \n\n"), - }), - theme.IconNameSettings: theme.NewThemedResource(&fyne.StaticResource{ StaticName: "applications-system-symbolic.svg", StaticContent: []byte("\n\n \n\n"), diff --git a/theme/adwaita_theme_generator.go b/theme/adwaita_theme_generator.go index 9bb7ee2f..c8c5aaaa 100644 --- a/theme/adwaita_theme_generator.go +++ b/theme/adwaita_theme_generator.go @@ -125,12 +125,13 @@ var ( } // map to describe the icons to get from the Adwaita gitlab page and the name of the icon in the Fyne theme + // note: all empty icons are those that are not defined yet. We should make some choices about them. iconsToGet = map[string]string{ "IconNameCancel": "symbolic/ui/window-close-symbolic.svg", "IconNameConfirm": "symbolic/actions/object-select-symbolic.svg", "IconNameDelete": "symbolic/places/user-trash-symbolic.svg", "IconNameSearch": "symbolic/actions/system-search-symbolic.svg", - "IconNameSearchReplace": "symbolic/actions/system-search-symbolic.svg", // to be changed + "IconNameSearchReplace": "", "IconNameMenu": "symbolic/actions/open-menu-symbolic.svg", "IconNameMenuExpand": "symbolic/ui/pan-end-symbolic.svg", From eee44a320e61af148511d4b8741c8e08ab1942ae Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Mon, 3 Jul 2023 09:14:27 +0200 Subject: [PATCH 05/12] Changed some icons, add others --- theme/adwaita_icons.go | 101 ++++++++++++++++++++++++++++++- theme/adwaita_theme_generator.go | 42 ++++++------- 2 files changed, 119 insertions(+), 24 deletions(-) diff --git a/theme/adwaita_icons.go b/theme/adwaita_icons.go index fadb6084..c75e7695 100644 --- a/theme/adwaita_icons.go +++ b/theme/adwaita_icons.go @@ -88,8 +88,8 @@ var adwaitaIcons = map[fyne.ThemeIconName]fyne.Resource{ }), theme.IconNameDelete: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "user-trash-symbolic.svg", - StaticContent: []byte("\n\n \n \n \n \n \n \n \n\n"), + StaticName: "edit-delete-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), }), theme.IconNameDocument: theme.NewThemedResource(&fyne.StaticResource{ @@ -187,6 +187,41 @@ var adwaitaIcons = map[fyne.ThemeIconName]fyne.Resource{ StaticContent: []byte("\n\n \n\n"), }), + theme.IconNameLogout: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "system-log-out-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameMailAttachment: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "mail-attachment-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMailCompose: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "mail-message-new-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMailForward: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "mail-forward-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMailReply: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "mail-reply-sender-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMailReplyAll: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "mail-reply-all-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameMailSend: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "mail-send-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + theme.IconNameMediaFastForward: theme.NewThemedResource(&fyne.StaticResource{ StaticName: "media-seek-forward-symbolic.svg", StaticContent: []byte("\n\n \n \n \n \n\n"), @@ -303,10 +338,15 @@ var adwaitaIcons = map[fyne.ThemeIconName]fyne.Resource{ }), theme.IconNameSearch: theme.NewThemedResource(&fyne.StaticResource{ - StaticName: "system-search-symbolic.svg", + StaticName: "edit-find-symbolic.svg", StaticContent: []byte("\n\n \n\n"), }), + theme.IconNameSearchReplace: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "edit-find-replace-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + theme.IconNameSettings: theme.NewThemedResource(&fyne.StaticResource{ StaticName: "applications-system-symbolic.svg", StaticContent: []byte("\n\n \n\n"), @@ -322,6 +362,61 @@ var adwaitaIcons = map[fyne.ThemeIconName]fyne.Resource{ StaticContent: []byte("\n\n \n\n"), }), + theme.IconNameViewFullScreen: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "view-fullscreen-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameViewRefresh: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "view-refresh-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameViewRestore: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "view-restore-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameViewZoomFit: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "zoom-fit-best-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameViewZoomIn: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "zoom-in-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameViewZoomOut: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "zoom-out-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameVisibility: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "view-reveal-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameVisibilityOff: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "view-conceal-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameVolumeDown: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "audio-volume-low-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + + theme.IconNameVolumeMute: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "audio-volume-muted-symbolic.svg", + StaticContent: []byte("\n\n \n \n \n \n\n"), + }), + + theme.IconNameVolumeUp: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "audio-volume-high-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + theme.IconNameWarning: theme.NewThemedResource(&fyne.StaticResource{ StaticName: "dialog-warning-symbolic.svg", StaticContent: []byte("\n\n \n\n"), diff --git a/theme/adwaita_theme_generator.go b/theme/adwaita_theme_generator.go index c8c5aaaa..0bff2fdc 100644 --- a/theme/adwaita_theme_generator.go +++ b/theme/adwaita_theme_generator.go @@ -129,9 +129,9 @@ var ( iconsToGet = map[string]string{ "IconNameCancel": "symbolic/ui/window-close-symbolic.svg", "IconNameConfirm": "symbolic/actions/object-select-symbolic.svg", - "IconNameDelete": "symbolic/places/user-trash-symbolic.svg", - "IconNameSearch": "symbolic/actions/system-search-symbolic.svg", - "IconNameSearchReplace": "", + "IconNameDelete": "symbolic/actions/edit-delete-symbolic.svg", + "IconNameSearch": "symbolic/actions/edit-find-symbolic.svg", + "IconNameSearchReplace": "symbolic/actions/edit-find-replace-symbolic.svg", "IconNameMenu": "symbolic/actions/open-menu-symbolic.svg", "IconNameMenuExpand": "symbolic/ui/pan-end-symbolic.svg", @@ -166,12 +166,12 @@ var ( "IconNameWarning": "symbolic/status/dialog-warning-symbolic.svg", "IconNameError": "symbolic/status/dialog-error-symbolic.svg", - "IconNameMailAttachment": "", - "IconNameMailCompose": "", - "IconNameMailForward": "", - "IconNameMailReply": "", - "IconNameMailReplyAll": "", - "IconNameMailSend": "", + "IconNameMailAttachment": "symbolic/status/mail-attachment-symbolic.svg", + "IconNameMailCompose": "symbolic/actions/mail-message-new-symbolic.svg", + "IconNameMailForward": "symbolic/actions/mail-forward-symbolic.svg", + "IconNameMailReply": "symbolic/actions/mail-reply-sender-symbolic.svg", + "IconNameMailReplyAll": "symbolic/actions/mail-reply-all-symbolic.svg", + "IconNameMailSend": "symbolic/actions/mail-send-symbolic.svg", "IconNameMediaMusic": "symbolic/mimetypes/audio-x-generic-symbolic.svg", "IconNameMediaPhoto": "symbolic/mimetypes/image-x-generic-symbolic.svg", @@ -207,19 +207,19 @@ var ( "IconNameHome": "symbolic/places/user-home-symbolic.svg", "IconNameSettings": "symbolic/categories/applications-system-symbolic.svg", - "IconNameViewFullScreen": "", - "IconNameViewRefresh": "", - "IconNameViewRestore": "", - "IconNameViewZoomFit": "", - "IconNameViewZoomIn": "", - "IconNameViewZoomOut": "", + "IconNameViewFullScreen": "symbolic/actions/view-fullscreen-symbolic.svg", + "IconNameViewRefresh": "symbolic/actions/view-refresh-symbolic.svg", + "IconNameViewRestore": "symbolic/actions/view-restore-symbolic.svg", + "IconNameViewZoomFit": "symbolic/actions/zoom-fit-best-symbolic.svg", + "IconNameViewZoomIn": "symbolic/actions/zoom-in-symbolic.svg", + "IconNameViewZoomOut": "symbolic/actions/zoom-out-symbolic.svg", - "IconNameVisibility": "", - "IconNameVisibilityOff": "", + "IconNameVisibility": "symbolic/actions/view-reveal-symbolic.svg", + "IconNameVisibilityOff": "symbolic/actions/view-conceal-symbolic.svg", - "IconNameVolumeDown": "", - "IconNameVolumeMute": "", - "IconNameVolumeUp": "", + "IconNameVolumeDown": "symbolic/status/audio-volume-low-symbolic.svg", + "IconNameVolumeMute": "symbolic/status/audio-volume-muted-symbolic.svg", + "IconNameVolumeUp": "symbolic/status/audio-volume-high-symbolic.svg", "IconNameDownload": "symbolic/places/folder-download-symbolic.svg", "IconNameComputer": "symbolic/devices/computer-symbolic.svg", @@ -228,7 +228,7 @@ var ( "IconNameAccount": "symbolic/status/avatar-default-symbolic.svg", "IconNameLogin": "", - "IconNameLogout": "", + "IconNameLogout": "symbolic/actions/system-log-out-symbolic.svg", "IconNameList": "symbolic/actions/view-list-symbolic.svg", "IconNameGrid": "symbolic/actions/view-grid-symbolic.svg", From 50d9a41c6c2d59c232a66aaf2df7019fd846321b Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Mon, 3 Jul 2023 09:32:11 +0200 Subject: [PATCH 06/12] Fix template usage - prefer to use fully named properties in color struct - prefer to use template to `printf` elements intead of doing it in the functions --- theme/adwaita_colors.go | 80 ++++++++++++++++---------------- theme/adwaita_icons.go | 7 +++ theme/adwaita_theme_generator.go | 32 ++++++++----- 3 files changed, 68 insertions(+), 51 deletions(-) diff --git a/theme/adwaita_colors.go b/theme/adwaita_colors.go index 4030e0e9..ad2b53dd 100644 --- a/theme/adwaita_colors.go +++ b/theme/adwaita_colors.go @@ -14,47 +14,47 @@ 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.RGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @blue_3 + theme.ColorBrown: color.RGBA{R: 0x98, G: 0x6a, B: 0x44, A: 0xff}, // Adwaita color name @brown_3 + theme.ColorGray: color.RGBA{R: 0x5e, G: 0x5c, B: 0x64, A: 0xff}, // Adwaita color name @dark_2 + theme.ColorGreen: color.RGBA{R: 0x26, G: 0xa2, B: 0x69, A: 0xff}, // Adwaita color name @green_5 + theme.ColorNameBackground: color.RGBA{R: 0x24, G: 0x24, B: 0x24, A: 0xff}, // Adwaita color name @window_bg_color + theme.ColorNameButton: color.RGBA{R: 0x30, G: 0x30, B: 0x30, A: 0xff}, // Adwaita color name @headerbar_bg_color + theme.ColorNameError: color.RGBA{R: 0xc0, G: 0x1c, B: 0x28, A: 0xff}, // Adwaita color name @error_bg_color + theme.ColorNameForeground: color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}, // Adwaita color name @window_fg_color + theme.ColorNameInputBackground: color.RGBA{R: 0x1e, G: 0x1e, B: 0x1e, A: 0xff}, // Adwaita color name @view_bg_color + theme.ColorNameMenuBackground: color.RGBA{R: 0x1e, G: 0x1e, B: 0x1e, A: 0xff}, // Adwaita color name @view_bg_color + theme.ColorNameOverlayBackground: color.RGBA{R: 0x1e, G: 0x1e, B: 0x1e, A: 0xff}, // Adwaita color name @view_bg_color + theme.ColorNamePrimary: color.RGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_bg_color + theme.ColorNameSelection: color.RGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_bg_color + theme.ColorNameShadow: color.RGBA{R: 0x00, G: 0x00, B: 0x00, A: 0x5b}, // Adwaita color name @shade_color + theme.ColorNameSuccess: color.RGBA{R: 0x26, G: 0xa2, B: 0x69, A: 0xff}, // Adwaita color name @success_bg_color + theme.ColorNameWarning: color.RGBA{R: 0xcd, G: 0x93, B: 0x09, A: 0xff}, // Adwaita color name @warning_bg_color + theme.ColorOrange: color.RGBA{R: 0xff, G: 0x78, B: 0x00, A: 0xff}, // Adwaita color name @orange_3 + theme.ColorPurple: color.RGBA{R: 0x91, G: 0x41, B: 0xac, A: 0xff}, // Adwaita color name @purple_3 + theme.ColorRed: color.RGBA{R: 0xc0, G: 0x1c, B: 0x28, A: 0xff}, // Adwaita color name @red_4 + theme.ColorYellow: color.RGBA{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.RGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @blue_3 + theme.ColorBrown: color.RGBA{R: 0x98, G: 0x6A, B: 0x44, A: 0xff}, // Adwaita color name @brown_3 + theme.ColorGray: color.RGBA{R: 0x5e, G: 0x5C, B: 0x64, A: 0xff}, // Adwaita color name @dark_2 + theme.ColorGreen: color.RGBA{R: 0x2e, G: 0xC2, B: 0x7e, A: 0xff}, // Adwaita color name @green_4 + theme.ColorNameBackground: color.RGBA{R: 0xfa, G: 0xFA, B: 0xfa, A: 0xff}, // Adwaita color name @window_bg_color + theme.ColorNameButton: color.RGBA{R: 0xeb, G: 0xEB, B: 0xeb, A: 0xff}, // Adwaita color name @headerbar_bg_color + theme.ColorNameError: color.RGBA{R: 0xe0, G: 0x1B, B: 0x24, A: 0xff}, // Adwaita color name @error_bg_color + theme.ColorNameForeground: color.RGBA{R: 0x00, G: 0x00, B: 0x00, A: 0xcc}, // Adwaita color name @window_fg_color + theme.ColorNameInputBackground: color.RGBA{R: 0xff, G: 0xFF, B: 0xff, A: 0xff}, // Adwaita color name @view_bg_color + theme.ColorNameMenuBackground: color.RGBA{R: 0xff, G: 0xFF, B: 0xff, A: 0xff}, // Adwaita color name @view_bg_color + theme.ColorNameOverlayBackground: color.RGBA{R: 0xff, G: 0xFF, B: 0xff, A: 0xff}, // Adwaita color name @view_bg_color + theme.ColorNamePrimary: color.RGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_bg_color + theme.ColorNameSelection: color.RGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_bg_color + theme.ColorNameShadow: color.RGBA{R: 0x00, G: 0x00, B: 0x00, A: 0x11}, // Adwaita color name @shade_color + theme.ColorNameSuccess: color.RGBA{R: 0x2e, G: 0xC2, B: 0x7e, A: 0xff}, // Adwaita color name @success_bg_color + theme.ColorNameWarning: color.RGBA{R: 0xe5, G: 0xA5, B: 0x0a, A: 0xff}, // Adwaita color name @warning_bg_color + theme.ColorOrange: color.RGBA{R: 0xff, G: 0x78, B: 0x00, A: 0xff}, // Adwaita color name @orange_3 + theme.ColorPurple: color.RGBA{R: 0x91, G: 0x41, B: 0xac, A: 0xff}, // Adwaita color name @purple_3 + theme.ColorRed: color.RGBA{R: 0xe0, G: 0x1B, B: 0x24, A: 0xff}, // Adwaita color name @red_3 + theme.ColorYellow: color.RGBA{R: 0xf6, G: 0xD3, B: 0x2d, A: 0xff}, // Adwaita color name @yellow_3 } diff --git a/theme/adwaita_icons.go b/theme/adwaita_icons.go index c75e7695..4d73c069 100644 --- a/theme/adwaita_icons.go +++ b/theme/adwaita_icons.go @@ -1,5 +1,12 @@ package theme +// This file is generated by adwaita_colors_generator.go - DO NOT EDIT +// +// This icons come from "GNOME Project" +// Repository: https://gitlab.gnome.org/GNOME/adwaita-icon-theme +// Licence: CC-BY-SA 3.0 +// See: https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/blob/master/COPYING_CCBYSA3 + import ( "fyne.io/fyne/v2" "fyne.io/fyne/v2/theme" diff --git a/theme/adwaita_theme_generator.go b/theme/adwaita_theme_generator.go index 0bff2fdc..0d05caf5 100644 --- a/theme/adwaita_theme_generator.go +++ b/theme/adwaita_theme_generator.go @@ -52,18 +52,25 @@ import ( var adwaitaDarkScheme = map[fyne.ThemeColorName]color.Color{ {{- range $key, $value := .DarkScheme }} - {{$key}}: {{$value.Col}}, // Adwaita color name @{{$value.AdwName}} + {{ $key }}: {{ printf "color.RGBA{R: 0x%02x, G: 0x%02x, B: 0x%02x, A: 0x%02x}" $value.Col.R $value.Col.G $value.Col.B $value.Col.A }}, // Adwaita color name @{{$value.AdwName}} {{- end }} } var adwaitaLightScheme = map[fyne.ThemeColorName]color.Color{ {{- range $key, $value := .LightScheme }} - {{$key}}: {{$value.Col}}, // Adwaita color name @{{$value.AdwName}} + {{ $key }}: {{ printf "color.RGBA{R: 0x%02x, G: 0x%02X, B: 0x%02x, A: 0x%02x}" $value.Col.R $value.Col.G $value.Col.B $value.Col.A }}, // Adwaita color name @{{$value.AdwName}} {{- end }} }` // the template where to bundle the icons in a map iconSourceTpl = `package theme +// This file is generated by adwaita_colors_generator.go - DO NOT EDIT +// +// This icons come from "GNOME Project" +// Repository: https://gitlab.gnome.org/GNOME/adwaita-icon-theme +// Licence: CC-BY-SA 3.0 +// See: https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/blob/master/COPYING_CCBYSA3 + import ( "fyne.io/fyne/v2" "fyne.io/fyne/v2/theme" @@ -236,8 +243,8 @@ var ( ) type colorInfo struct { - Col string // go formated color (color.RGBA{0x00, 0x00, 0x00, 0x00}) - AdwName string // Adwaita color name from the documentation without the "@" + Col color.Color // go formated color (color.RGBA{0x00, 0x00, 0x00, 0x00}) + AdwName string // Adwaita color name from the documentation without the "@" } type iconInfo struct { StaticName string // the theme name of the icon for Fyne @@ -319,11 +326,11 @@ func generateColorScheme() error { return fmt.Errorf("failed to get dark color for %s: %w", color, err) } lightScheme[colname] = colorInfo{ - Col: fmt.Sprintf("color.RGBA{0x%02x, 0x%02x, 0x%02x, 0x%02x}", lcol.R, lcol.G, lcol.B, lcol.A), + Col: lcol, AdwName: color, } darkScheme[colname] = colorInfo{ - Col: fmt.Sprintf("color.RGBA{0x%02x, 0x%02x, 0x%02x, 0x%02x}", dcol.R, dcol.G, dcol.B, dcol.A), + Col: dcol, AdwName: color, } } @@ -346,16 +353,16 @@ func generateColorScheme() error { return fmt.Errorf("failed to get dark color for %s: %w", darkColorName, err) } lightScheme[colname] = colorInfo{ - Col: fmt.Sprintf("color.RGBA{0x%02x, 0x%02x, 0x%02x, 0x%02x}", lcol.R, lcol.G, lcol.B, lcol.A), + Col: lcol, AdwName: lightColorName, } darkScheme[colname] = colorInfo{ - Col: fmt.Sprintf("color.RGBA{0x%02x, 0x%02x, 0x%02x, 0x%02x}", dcol.R, dcol.G, dcol.B, dcol.A), + Col: dcol, AdwName: darkColorName, } } - tpl := template.New("source") + tpl := template.New("AdwaitaColorScheme") tpl, err = tpl.Parse(colorSourceTpl) if err != nil { return fmt.Errorf("failed to parse template: %w", err) @@ -386,7 +393,7 @@ func generateColorScheme() error { // Then, using the icons map, it get the corresponding icon and generate the go file. func generateIcons() error { - // get https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/archive/master/adwaita-icon-theme-master.tar?path=Adwaita as a tar file and extract it in memory + // get and untar the Adwaita icons from gitlab repository resp, err := http.Get(adwaitaIconsPage) if err != nil { return err @@ -400,6 +407,8 @@ func generateIcons() error { return err } defer os.RemoveAll(tmpDir) + + // extract the tar file for { header, err := tarReader.Next() if err == io.EOF { @@ -425,6 +434,7 @@ func generateIcons() error { } } + // get the wanted icons icons := map[string]iconInfo{} for name, iconfile := range iconsToGet { if iconfile == "" { @@ -444,7 +454,7 @@ func generateIcons() error { } } - tpl := template.New("source") + tpl := template.New("AdwaitaIcons") tpl = tpl.Funcs(template.FuncMap{ "contains": strings.Contains, }) From a7b71318907e53309e951f6575cb1da9808cfed3 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Mon, 3 Jul 2023 09:41:38 +0200 Subject: [PATCH 07/12] Fix docstring --- theme/adwaita.go | 6 ++---- theme/adwaita_colors.go | 2 +- theme/adwaita_icons.go | 4 +++- theme/adwaita_theme_generator.go | 20 +++++++++++++++----- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/theme/adwaita.go b/theme/adwaita.go index 2be114f0..3a8f0727 100644 --- a/theme/adwaita.go +++ b/theme/adwaita.go @@ -1,3 +1,4 @@ +//go:generate go run ./adwaita_theme_generator.go package theme import ( @@ -7,12 +8,9 @@ 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_theme_generator.go - var _ fyne.Theme = (*Adwaita)(nil) -// Adwaita is a theme that follows the Adwaita theme. +// 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{} diff --git a/theme/adwaita_colors.go b/theme/adwaita_colors.go index ad2b53dd..0e150d03 100644 --- a/theme/adwaita_colors.go +++ b/theme/adwaita_colors.go @@ -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/... // diff --git a/theme/adwaita_icons.go b/theme/adwaita_icons.go index 4d73c069..8efd5296 100644 --- a/theme/adwaita_icons.go +++ b/theme/adwaita_icons.go @@ -1,6 +1,8 @@ package theme -// This file is generated by adwaita_colors_generator.go - DO NOT EDIT +// This file is generated by adwaita_theme_generator.go +// Please do not edit manually, use: +// go generate ./theme/... // // This icons come from "GNOME Project" // Repository: https://gitlab.gnome.org/GNOME/adwaita-icon-theme diff --git a/theme/adwaita_theme_generator.go b/theme/adwaita_theme_generator.go index 0d05caf5..c37b52e8 100644 --- a/theme/adwaita_theme_generator.go +++ b/theme/adwaita_theme_generator.go @@ -2,9 +2,17 @@ // +build ignore /* -This tool will visit the Adwaita color page and generate a Go file with all the colors. -To add a new color, just add it to the colorToGet map. The key is the name of the color for Fyne, and the color name -is the name of the color in the Adwaita page without the "@". +This tool generates the Adwaita theme for Fyne. + +It takes the colors from the Adwaita page: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.0/named-colors.html +and the icons from the Adwaita icon theme: https://gitlab.gnome.org/GNOME/adwaita-icon-theme + +There are 2 outputs: +- adwaita_colors.go: the colors for the theme as map[fyne.ThemeColorName]color.Color +- adwaita_icons.go: the icons for the theme as fyne.Resource (themed for symbolic icons) + +Usage: +go generate ./theme/... */ package main @@ -37,7 +45,7 @@ const ( // the template to generate the color scheme colorSourceTpl = `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/... // @@ -64,7 +72,9 @@ var adwaitaLightScheme = map[fyne.ThemeColorName]color.Color{ // the template where to bundle the icons in a map iconSourceTpl = `package theme -// This file is generated by adwaita_colors_generator.go - DO NOT EDIT +// This file is generated by adwaita_theme_generator.go +// Please do not edit manually, use: +// go generate ./theme/... // // This icons come from "GNOME Project" // Repository: https://gitlab.gnome.org/GNOME/adwaita-icon-theme From c0baa2d0876c7067b7589f50f3ad878f6965631f Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Mon, 3 Jul 2023 09:45:27 +0200 Subject: [PATCH 08/12] Go generate comment should not be the first line --- theme/adwaita.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/theme/adwaita.go b/theme/adwaita.go index 3a8f0727..7455b383 100644 --- a/theme/adwaita.go +++ b/theme/adwaita.go @@ -1,4 +1,3 @@ -//go:generate go run ./adwaita_theme_generator.go package theme import ( @@ -8,6 +7,8 @@ import ( "fyne.io/fyne/v2/theme" ) +//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. From 12b4d47fdd1f0375c03da1f85346e21c218fd456 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Mon, 3 Jul 2023 11:11:22 +0200 Subject: [PATCH 09/12] Convert 2 problematic icons to PNG oksvg has got some problems with gradients and with masked icon. Today, use inkscape in command line to convert them to PNG. Warning, inkscape says that it crashes with core dump even if the convertion worked. This is a bug from inkscape. The PNG files are well converted anyway. --- theme/adwaita_icons.go | 18 ++++++++++---- theme/adwaita_theme_generator.go | 41 ++++++++++++++++++++++++++++---- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/theme/adwaita_icons.go b/theme/adwaita_icons.go index 8efd5296..433dccc0 100644 --- a/theme/adwaita_icons.go +++ b/theme/adwaita_icons.go @@ -46,6 +46,11 @@ var adwaitaIcons = map[fyne.ThemeIconName]fyne.Resource{ StaticContent: []byte("\n\n \n\n"), }), + theme.IconNameColorPalette: theme.NewThemedResource(&fyne.StaticResource{ + StaticName: "applications-graphics-symbolic.svg", + StaticContent: []byte("\n\n \n\n"), + }), + theme.IconNameComputer: theme.NewThemedResource(&fyne.StaticResource{ StaticName: "computer-symbolic.svg", StaticContent: []byte("\n\n \n\n"), @@ -131,14 +136,19 @@ var adwaitaIcons = map[fyne.ThemeIconName]fyne.Resource{ StaticContent: []byte("\n\n \n\n"), }), + theme.IconNameFile: &fyne.StaticResource{ + StaticName: "application-x-generic.svg", + StaticContent: []byte("\n\n \n \n\n"), + }, + theme.IconNameFileApplication: &fyne.StaticResource{ - StaticName: "application-x-executable.svg", - StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"), + StaticName: "application-x-executable.png", + StaticContent: []byte("\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00w\x00\x00\x00w\b\x06\x00\x00\x0099ߊ\x00\x00\x00\tpHYs\x00\x00\x0e\xc3\x00\x00\x0e\xc3\x01\xc7o\xa8d\x00\x00\x00\x19tEXtSoftware\x00www.inkscape.org\x9b\xee<\x1a\x00\x00\x10\xa9IDATx\x9cݝ{\x8c\\\xd5}\xc7?\xe7\xbef\xee\xcc\xec\xecs\xd6އ\x97\xdd\xf5\xda\xc6\xc6\x10\b\x04\xc2#D!\x82\x94\xaa\xa9Ԧ\xff\xb4A\xaa\xaa\xb4\xe4\x81ڨI\xd5\xfe\xd1JQ\x84\xa2J\x91\xa8ڤM\x89\x924R\vj*\xaaHQi @\xa3R\xa0\x94\x02q\xd8\xda\x18\xb0\x8d\x1f\xd8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p\xa11\xe0\xaa\x14UCU\x15\x84\xa2\"]\a\xc7qp\x9d\xfa\xe1\x93\xe3}\xba=3\x12\xff\xb3\xa8\x83\x85m\x02\x17\xb6\x06܌\x04\xa2\xf4\xd1}\xe9\xaf\xfc\xf0\xf33\xdf\xf1\xb0h]Ӷ\x81\v\x9d\x01\x16\x88Ҡ\xe9~\xfa\xc5o\xdc\xf2\xac\x0fE늶\x15\\h\x0fp\x14&\x01\xdaѶ\x83\v0\xf9G/\xdfd\xea\xb1\x17\xa4\x94ɭ\xceU\x10\xf9\xbcp\xef:\xf5\xc8-\x87\x82([\x90\x8a\x9c\x13\xa3\x19\x9d\xfa\xd6\xed\x874\xb2\xfbUM?\xdd\xe8\x1c\x01h\x9a~F\x15\xd9k\xb7#Xئ5\xb7*\x01↿x狮c?\x80\x94\xd7J){\x84\x10+\b\x8e*Z\xec\xb1هg\x1e\x95]\xdf\x7f\xc5?\xfd?7u\xd2W_^\xf1;\x00\x00\x00\x00IEND\xaeB`\x82"), }, theme.IconNameFileAudio: &fyne.StaticResource{ - StaticName: "audio-x-generic.svg", - StaticContent: []byte("\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"), + StaticName: "audio-x-generic.png", + StaticContent: []byte("\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00t\x00\x00\x00l\b\x06\x00\x00\x00\xbb\x1f\x96\xd1\x00\x00\x00\tpHYs\x00\x00\x0e\xc3\x00\x00\x0e\xc3\x01\xc7o\xa8d\x00\x00\x00\x19tEXtSoftware\x00www.inkscape.org\x9b\xee<\x1a\x00\x00\x19\xdaIDATx\x9c\xed\x9d\x7f\xb4\x1dWu\xdf?\xfb\x9c\xb9\xf7==Y\xb6\x8c\x89M!\r\xe0Ę\x1fF\xd8\xd6\x0fS\xd2Յ\xca*]-mI\x17e\x11ۈ\xd0\xfc\x80\xac\x14hh\x01\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9E\xd6\r\xaf_\x18\xa1\xb6GDn\x0e\x92\xdd\xfc\xe0ş}I\xbe\x7f\xfe\r߾\xfcu~\xb2\xd8\x16\xba\xf9E\xd6)\xce\\\x00\xa1&\xd8=\x86\xbb\xa9\x15\xf8\xca\xde\x0f~\xfe\x89\xd9Oi\xc6H\x84\xd6q\xce\xd7~\xfb\xe7\xf2\xc9\xeeV\x90M\bg\x9b\xd9kD8\x8d\xf4G\x04\x80\xa3\xc0\xb3\x06\a1\xdb琻h\xfb[\xf7\xfd\xf2\xe7~\xba(\x02,\x13\x9c\xf5\xa7\x1f\xfby\x97\x17[\xcd8_\xcc^\x87ȫ\xa1\xd2C \xe9\x01\xe4o\x10ۇٝyV\xdc\xf6\xe3\v\xffx\xa4;\x17K\xfc?:\xda\\\x86s0\x9b\x04\x00\x00\x00\x00IEND\xaeB`\x82"), }, theme.IconNameFileImage: &fyne.StaticResource{ diff --git a/theme/adwaita_theme_generator.go b/theme/adwaita_theme_generator.go index c37b52e8..16171ea6 100644 --- a/theme/adwaita_theme_generator.go +++ b/theme/adwaita_theme_generator.go @@ -28,6 +28,7 @@ import ( "log" "net/http" "os" + "os/exec" "path/filepath" "regexp" "strings" @@ -168,7 +169,7 @@ var ( "IconNameColorAchromatic": "", "IconNameColorChromatic": "", - "IconNameColorPalette": "", + "IconNameColorPalette": "symbolic/categories/applications-graphics-symbolic.svg", "IconNameDocument": "symbolic/mimetypes/text-x-generic-symbolic.svg", "IconNameDocumentCreate": "symbolic/actions/document-new-symbolic.svg", @@ -210,7 +211,7 @@ var ( "IconNameArrowDropDown": "symbolic/actions/go-down-symbolic.svg", "IconNameArrowDropUp": "symbolic/actions/go-up-symbolic.svg", - "IconNameFile": "", + "IconNameFile": "scalable/mimetypes/application-x-generic.svg", "IconNameFileApplication": "scalable/mimetypes/application-x-executable.svg", "IconNameFileAudio": "scalable/mimetypes/audio-x-generic.svg", "IconNameFileImage": "scalable/mimetypes/image-x-generic.svg", @@ -250,6 +251,11 @@ var ( "IconNameList": "symbolic/actions/view-list-symbolic.svg", "IconNameGrid": "symbolic/actions/view-grid-symbolic.svg", } + inkscape, _ = exec.LookPath("inkscape") + forcePNG = map[string]bool{ + "IconNameFileAudio": true, + "IconNameFileApplication": true, + } ) type colorInfo struct { @@ -450,16 +456,23 @@ func generateIcons() error { if iconfile == "" { continue } - res, err := fyne.LoadResourceFromPath(filepath.Join(tmpDir, "adwaita-icon-theme-master-Adwaita", "Adwaita", iconfile)) + + iconPath := filepath.Join(tmpDir, "adwaita-icon-theme-master-Adwaita", "Adwaita", iconfile) + if _, ok := forcePNG[name]; ok { + svgToPng(iconPath) + iconPath = strings.TrimSuffix(iconPath, ".svg") + ".png" + } + + res, err := fyne.LoadResourceFromPath(iconPath) if err != nil { - log.Println("Error bundeling", name, "from", iconfile, ":", err) + log.Println("Error bundeling", name, "from", iconPath, ":", err) continue } filecontent := res.Content() icons[name] = iconInfo{ - StaticName: filepath.Base(iconfile), + StaticName: filepath.Base(iconPath), Content: string(filecontent), } } @@ -490,6 +503,24 @@ func generateIcons() error { } } +// svgToPng converts an SVG file to a PNG file using inkscape. +// +// TODO: fix oksvg to support all SVG files. +func svgToPng(filename string) error { + // use inkscape to fix SVG files + if inkscape == "" { + return fmt.Errorf("inkscape not found") + } + log.Println("Converting", filename, "to PNG") + cmd := exec.Command( + inkscape, + "--export-type=png", + "--export-area-drawing", + "--vacuum-defs", + filename) + return cmd.Run() +} + // stringToColor converts a string to a color.RGBA func stringToColor(s string) (c color.RGBA, err error) { c.A = 0xff From a4f3fdc051dc84924003486dafb6cbf90c100de2 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Mon, 3 Jul 2023 14:25:27 +0200 Subject: [PATCH 10/12] Fixup sizes (see details), scrollbar colors - sizes of icon and text should respect the Adwaita sizes, so I need to set up: - padding to 8 - inline icons to 16 - text to 12 - fixed the scrollbar color to respect Adwaita colors (estimation made, there is no color set fot scrollbar in the documentation) --- theme/adwaita.go | 8 ++++ theme/adwaita_colors.go | 82 ++++++++++++++++---------------- theme/adwaita_theme_generator.go | 13 ++++- 3 files changed, 61 insertions(+), 42 deletions(-) diff --git a/theme/adwaita.go b/theme/adwaita.go index 7455b383..6e46362e 100644 --- a/theme/adwaita.go +++ b/theme/adwaita.go @@ -50,5 +50,13 @@ func (a *Adwaita) Icon(name fyne.ThemeIconName) fyne.Resource { // 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) } diff --git a/theme/adwaita_colors.go b/theme/adwaita_colors.go index 0e150d03..1f62b40d 100644 --- a/theme/adwaita_colors.go +++ b/theme/adwaita_colors.go @@ -14,47 +14,49 @@ import ( ) var adwaitaDarkScheme = map[fyne.ThemeColorName]color.Color{ - theme.ColorBlue: color.RGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @blue_3 - theme.ColorBrown: color.RGBA{R: 0x98, G: 0x6a, B: 0x44, A: 0xff}, // Adwaita color name @brown_3 - theme.ColorGray: color.RGBA{R: 0x5e, G: 0x5c, B: 0x64, A: 0xff}, // Adwaita color name @dark_2 - theme.ColorGreen: color.RGBA{R: 0x26, G: 0xa2, B: 0x69, A: 0xff}, // Adwaita color name @green_5 - theme.ColorNameBackground: color.RGBA{R: 0x24, G: 0x24, B: 0x24, A: 0xff}, // Adwaita color name @window_bg_color - theme.ColorNameButton: color.RGBA{R: 0x30, G: 0x30, B: 0x30, A: 0xff}, // Adwaita color name @headerbar_bg_color - theme.ColorNameError: color.RGBA{R: 0xc0, G: 0x1c, B: 0x28, A: 0xff}, // Adwaita color name @error_bg_color - theme.ColorNameForeground: color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}, // Adwaita color name @window_fg_color - theme.ColorNameInputBackground: color.RGBA{R: 0x1e, G: 0x1e, B: 0x1e, A: 0xff}, // Adwaita color name @view_bg_color - theme.ColorNameMenuBackground: color.RGBA{R: 0x1e, G: 0x1e, B: 0x1e, A: 0xff}, // Adwaita color name @view_bg_color - theme.ColorNameOverlayBackground: color.RGBA{R: 0x1e, G: 0x1e, B: 0x1e, A: 0xff}, // Adwaita color name @view_bg_color - theme.ColorNamePrimary: color.RGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_bg_color - theme.ColorNameSelection: color.RGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_bg_color - theme.ColorNameShadow: color.RGBA{R: 0x00, G: 0x00, B: 0x00, A: 0x5b}, // Adwaita color name @shade_color - theme.ColorNameSuccess: color.RGBA{R: 0x26, G: 0xa2, B: 0x69, A: 0xff}, // Adwaita color name @success_bg_color - theme.ColorNameWarning: color.RGBA{R: 0xcd, G: 0x93, B: 0x09, A: 0xff}, // Adwaita color name @warning_bg_color - theme.ColorOrange: color.RGBA{R: 0xff, G: 0x78, B: 0x00, A: 0xff}, // Adwaita color name @orange_3 - theme.ColorPurple: color.RGBA{R: 0x91, G: 0x41, B: 0xac, A: 0xff}, // Adwaita color name @purple_3 - theme.ColorRed: color.RGBA{R: 0xc0, G: 0x1c, B: 0x28, A: 0xff}, // Adwaita color name @red_4 - theme.ColorYellow: color.RGBA{R: 0xf6, G: 0xd3, B: 0x2d, A: 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: 0x1e, G: 0x1e, B: 0x1e, A: 0xff}, // Adwaita color name @view_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: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_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{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @blue_3 - theme.ColorBrown: color.RGBA{R: 0x98, G: 0x6A, B: 0x44, A: 0xff}, // Adwaita color name @brown_3 - theme.ColorGray: color.RGBA{R: 0x5e, G: 0x5C, B: 0x64, A: 0xff}, // Adwaita color name @dark_2 - theme.ColorGreen: color.RGBA{R: 0x2e, G: 0xC2, B: 0x7e, A: 0xff}, // Adwaita color name @green_4 - theme.ColorNameBackground: color.RGBA{R: 0xfa, G: 0xFA, B: 0xfa, A: 0xff}, // Adwaita color name @window_bg_color - theme.ColorNameButton: color.RGBA{R: 0xeb, G: 0xEB, B: 0xeb, A: 0xff}, // Adwaita color name @headerbar_bg_color - theme.ColorNameError: color.RGBA{R: 0xe0, G: 0x1B, B: 0x24, A: 0xff}, // Adwaita color name @error_bg_color - theme.ColorNameForeground: color.RGBA{R: 0x00, G: 0x00, B: 0x00, A: 0xcc}, // Adwaita color name @window_fg_color - theme.ColorNameInputBackground: color.RGBA{R: 0xff, G: 0xFF, B: 0xff, A: 0xff}, // Adwaita color name @view_bg_color - theme.ColorNameMenuBackground: color.RGBA{R: 0xff, G: 0xFF, B: 0xff, A: 0xff}, // Adwaita color name @view_bg_color - theme.ColorNameOverlayBackground: color.RGBA{R: 0xff, G: 0xFF, B: 0xff, A: 0xff}, // Adwaita color name @view_bg_color - theme.ColorNamePrimary: color.RGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_bg_color - theme.ColorNameSelection: color.RGBA{R: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_bg_color - theme.ColorNameShadow: color.RGBA{R: 0x00, G: 0x00, B: 0x00, A: 0x11}, // Adwaita color name @shade_color - theme.ColorNameSuccess: color.RGBA{R: 0x2e, G: 0xC2, B: 0x7e, A: 0xff}, // Adwaita color name @success_bg_color - theme.ColorNameWarning: color.RGBA{R: 0xe5, G: 0xA5, B: 0x0a, A: 0xff}, // Adwaita color name @warning_bg_color - theme.ColorOrange: color.RGBA{R: 0xff, G: 0x78, B: 0x00, A: 0xff}, // Adwaita color name @orange_3 - theme.ColorPurple: color.RGBA{R: 0x91, G: 0x41, B: 0xac, A: 0xff}, // Adwaita color name @purple_3 - theme.ColorRed: color.RGBA{R: 0xe0, G: 0x1B, B: 0x24, A: 0xff}, // Adwaita color name @red_3 - theme.ColorYellow: color.RGBA{R: 0xf6, G: 0xD3, B: 0x2d, A: 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 @view_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: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_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 } diff --git a/theme/adwaita_theme_generator.go b/theme/adwaita_theme_generator.go index 16171ea6..6220fed2 100644 --- a/theme/adwaita_theme_generator.go +++ b/theme/adwaita_theme_generator.go @@ -61,13 +61,13 @@ import ( var adwaitaDarkScheme = map[fyne.ThemeColorName]color.Color{ {{- range $key, $value := .DarkScheme }} - {{ $key }}: {{ printf "color.RGBA{R: 0x%02x, G: 0x%02x, B: 0x%02x, A: 0x%02x}" $value.Col.R $value.Col.G $value.Col.B $value.Col.A }}, // Adwaita color name @{{$value.AdwName}} + {{ $key }}: {{ printf "color.NRGBA{R: 0x%02x, G: 0x%02x, B: 0x%02x, A: 0x%02x}" $value.Col.R $value.Col.G $value.Col.B $value.Col.A }}, // Adwaita color name @{{$value.AdwName}} {{- end }} } var adwaitaLightScheme = map[fyne.ThemeColorName]color.Color{ {{- range $key, $value := .LightScheme }} - {{ $key }}: {{ printf "color.RGBA{R: 0x%02x, G: 0x%02X, B: 0x%02x, A: 0x%02x}" $value.Col.R $value.Col.G $value.Col.B $value.Col.A }}, // Adwaita color name @{{$value.AdwName}} + {{ $key }}: {{ printf "color.NRGBA{R: 0x%02x, G: 0x%02X, B: 0x%02x, A: 0x%02x}" $value.Col.R $value.Col.G $value.Col.B $value.Col.A }}, // Adwaita color name @{{$value.AdwName}} {{- end }} }` // the template where to bundle the icons in a map @@ -140,6 +140,8 @@ var ( "theme.ColorPurple": "purple_3", "theme.ColorBrown": "brown_3", "theme.ColorGray": "dark_2", + // specific + "theme.ColorNameScrollBar": "dark_5,light_1", // and we will change the alpha value later } // map to describe the icons to get from the Adwaita gitlab page and the name of the icon in the Fyne theme @@ -368,6 +370,13 @@ func generateColorScheme() error { if err != nil { return fmt.Errorf("failed to get dark color for %s: %w", darkColorName, err) } + + // special case, alpha channel is 0x5b for scrollbar + if colname == "theme.ColorNameScrollBar" { + lcol.A = 0x5b + dcol.A = 0x5b + } + lightScheme[colname] = colorInfo{ Col: lcol, AdwName: lightColorName, From 083362f6aec2b8dfc2949be2adf6eff4d403c126 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Mon, 3 Jul 2023 14:39:04 +0200 Subject: [PATCH 11/12] Fixup the color of selection and menu Actually, Adwaita doesn't document everything - at this time I need to decide which is the closer color using the theme on GNOME and comparing with a Fyne application. --- theme/adwaita_colors.go | 8 ++++---- theme/adwaita_theme_generator.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/theme/adwaita_colors.go b/theme/adwaita_colors.go index 1f62b40d..85b78be1 100644 --- a/theme/adwaita_colors.go +++ b/theme/adwaita_colors.go @@ -23,11 +23,11 @@ var adwaitaDarkScheme = map[fyne.ThemeColorName]color.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: 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: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_bg_color + 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 @@ -47,11 +47,11 @@ var adwaitaLightScheme = map[fyne.ThemeColorName]color.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 @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: 0x35, G: 0x84, B: 0xe4, A: 0xff}, // Adwaita color name @accent_bg_color + 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 diff --git a/theme/adwaita_theme_generator.go b/theme/adwaita_theme_generator.go index 6220fed2..fa99b3d5 100644 --- a/theme/adwaita_theme_generator.go +++ b/theme/adwaita_theme_generator.go @@ -115,10 +115,10 @@ var ( // map to describe the colors to get from the Adwaita page and the name of the color in the Fyne theme colorToGet = map[string]string{ - "theme.ColorNameBackground": "window_bg_color", // or "view_bg_color" - "theme.ColorNameForeground": "window_fg_color", // or "view_fg_color" - "theme.ColorNameMenuBackground": "view_bg_color", // not sure about this one - "theme.ColorNameSelection": "accent_bg_color", + "theme.ColorNameBackground": "window_bg_color", // or "view_bg_color" + "theme.ColorNameForeground": "window_fg_color", // or "view_fg_color" + "theme.ColorNameMenuBackground": "popover_bg_color", // not sure about this one + "theme.ColorNameSelection": "headerbar_bg_color", "theme.ColorNameOverlayBackground": "view_bg_color", // not sure about this one "theme.ColorNamePrimary": "accent_bg_color", // accent_color is the primary color for Adwaita "theme.ColorNameInputBackground": "view_bg_color", // or "window_bg_color" From 9d104824aaf743b7608ce346457fdaf0059768e8 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Fri, 6 Oct 2023 00:10:48 +0200 Subject: [PATCH 12/12] Remove the modified sizes --- theme/adwaita.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/theme/adwaita.go b/theme/adwaita.go index 6e46362e..7455b383 100644 --- a/theme/adwaita.go +++ b/theme/adwaita.go @@ -50,13 +50,5 @@ func (a *Adwaita) Icon(name fyne.ThemeIconName) fyne.Resource { // 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) }