From b7f8882f0ff8994593999964d7a4493817ebdfd7 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Sat, 17 Aug 2024 11:11:57 +0100 Subject: [PATCH] Fix more deprecations --- internal/ui/about.go | 11 +++++++---- internal/ui/bar.go | 8 ++++---- internal/ui/bar_test.go | 2 +- internal/ui/menu.go | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/internal/ui/about.go b/internal/ui/about.go index 65500f91..e5d5c3b4 100644 --- a/internal/ui/about.go +++ b/internal/ui/about.go @@ -68,8 +68,9 @@ func (w *widgetPanel) showAbout() { widget.NewLabelWithStyle("\nWith great thanks to our many kind contributors\n", fyne.TextAlignCenter, fyne.TextStyle{Italic: true})) scroll := container.NewScroll(content) - bgColor := withAlpha(theme.BackgroundColor(), 0xe0) - shadowColor := withAlpha(theme.BackgroundColor(), 0x33) + themeBG := theme.Color(theme.ColorNameBackground) + bgColor := withAlpha(themeBG, 0xe0) + shadowColor := withAlpha(themeBG, 0x33) underlay := canvas.NewImageFromResource(theme2.FyshOSLogo) bg := canvas.NewRectangle(bgColor) @@ -81,11 +82,13 @@ func (w *widgetPanel) showAbout() { fyne.CurrentApp().Settings().AddChangeListener(listen) go func() { for range listen { - bgColor = withAlpha(theme.BackgroundColor(), 0xe0) + themeBG := theme.Color(theme.ColorNameBackground) + + bgColor = withAlpha(themeBG, 0xe0) bg.FillColor = bgColor bg.Refresh() - shadowColor = withAlpha(theme.BackgroundColor(), 0x33) + shadowColor = withAlpha(themeBG, 0x33) footerBG.FillColor = bgColor footer.Refresh() } diff --git a/internal/ui/bar.go b/internal/ui/bar.go index a0a1365d..f7d0596d 100644 --- a/internal/ui/bar.go +++ b/internal/ui/bar.go @@ -66,7 +66,7 @@ func (b *bar) append(object fyne.CanvasObject) { // appendSeparator adds a separator between the default icons and the taskbar func (b *bar) appendSeparator() { - b.separator = canvas.NewRectangle(theme.ForegroundColor()) + b.separator = canvas.NewRectangle(theme.Color(theme.ColorNameForeground)) b.append(b.separator) } @@ -278,7 +278,7 @@ func (b *bar) CreateRenderer() fyne.WidgetRenderer { if fynedesk.Instance().Settings().NarrowLeftLauncher() { bg = canvas.NewRectangle(wmTheme.WidgetPanelBackground()) } else { - bg = canvas.NewLinearGradient(theme.BackgroundColor(), color.Transparent, 180) + bg = canvas.NewLinearGradient(theme.Color(theme.ColorNameBackground), color.Transparent, 180) } return &barRenderer{objects: b.children, background: bg, layout: newBarLayout(b), appBar: b} } @@ -335,10 +335,10 @@ func (b *barRenderer) Refresh() { if fynedesk.Instance().Settings().NarrowLeftLauncher() { b.background = canvas.NewRectangle(wmTheme.WidgetPanelBackground()) } else { - b.background = canvas.NewLinearGradient(theme.BackgroundColor(), color.Transparent, 180) + b.background = canvas.NewLinearGradient(theme.Color(theme.ColorNameBackground), color.Transparent, 180) } if b.appBar.separator != nil { - b.appBar.separator.FillColor = theme.ForegroundColor() + b.appBar.separator.FillColor = theme.Color(theme.ColorNameForeground) } b.objects = b.appBar.children b.Layout(b.appBar.Size()) diff --git a/internal/ui/bar_test.go b/internal/ui/bar_test.go index 7b7a2d0f..5dfad73b 100644 --- a/internal/ui/bar_test.go +++ b/internal/ui/bar_test.go @@ -89,7 +89,7 @@ func TestAppBarBackground(t *testing.T) { assert.Equal(t, wmTheme.NarrowBarWidth, bg.Size().Width) } else { assert.Equal(t, color.Transparent, bg.(*canvas.LinearGradient).EndColor) - assert.Equal(t, theme.BackgroundColor(), bg.(*canvas.LinearGradient).StartColor) + assert.Equal(t, theme.Color(theme.ColorNameBackground), bg.(*canvas.LinearGradient).StartColor) assert.Equal(t, testBar.iconSize+theme.Padding()*2, bg.Size().Width) } } diff --git a/internal/ui/menu.go b/internal/ui/menu.go index f9b27bfe..1e2d549c 100644 --- a/internal/ui/menu.go +++ b/internal/ui/menu.go @@ -78,7 +78,7 @@ func (w *widgetPanel) askLogout() { nil, nil, widget.NewLabel("Are you sure you want to log out?")) - r, g, b, _ := theme.OverlayBackgroundColor().RGBA() + r, g, b, _ := theme.Color(theme.ColorNameOverlayBackground).RGBA() bgCol := &color.NRGBA{R: uint8(r), G: uint8(g), B: uint8(b), A: 230} bg := canvas.NewRectangle(bgCol)