Skip to content

Commit

Permalink
Additional colour deprecations removed
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Aug 17, 2024
1 parent b7f8882 commit 2f3e91e
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion internal/ui/switcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (s switchIconRenderer) MinSize() fyne.Size {

func (s switchIconRenderer) Refresh() {
if s.icon.current {
s.bg.FillColor = theme.PrimaryColor()
s.bg.FillColor = theme.Color(theme.ColorNamePrimary)
} else {
s.bg.FillColor = color.Transparent
}
Expand Down
10 changes: 6 additions & 4 deletions internal/ui/widgetpanel.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ func (w *widgetRenderer) Refresh() {
w.panel.clocks.Objects[0].Show()
w.panel.clocks.Objects[1].Hide()
}
w.panel.clock.Color = theme.ForegroundColor()
w.panel.vClock.Color = theme.ForegroundColor()
fg := theme.Color(theme.ColorNamePrimary)
w.panel.clock.Color = fg
w.panel.vClock.Color = fg
canvas.Refresh(w.panel.clock)
}

Expand Down Expand Up @@ -116,15 +117,16 @@ func (w *widgetPanel) createClock() {
var style fyne.TextStyle
style.Monospace = true

fg := theme.Color(theme.ColorNamePrimary)
w.clock = &canvas.Text{
Color: theme.ForegroundColor(),
Color: fg,
Text: w.formattedTime(),
Alignment: fyne.TextAlignCenter,
TextStyle: style,
TextSize: 3 * theme.TextSize(),
}
w.vClock = &canvas.Text{
Color: theme.ForegroundColor(),
Color: fg,
Text: w.formattedTime(),
Alignment: fyne.TextAlignCenter,
TextStyle: style,
Expand Down
4 changes: 2 additions & 2 deletions internal/x11/win/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ func (c *client) NotifyMouseMotion(x, y int16) {
c.frame.mouseMotion(x, y)
}

func (c *client) NotifyMousePress(x, y int16, b xproto.Button) {
c.frame.mousePress(x, y, b)
func (c *client) NotifyMousePress(x, y int16, b xproto.Button, s uint16) {
c.frame.mousePress(x, y, b, s)

Check failure on line 270 in internal/x11/win/client.go

View workflow job for this annotation

GitHub Actions / platform_tests (1.19, ubuntu-latest)

too many arguments in call to c.frame.mousePress

Check failure on line 270 in internal/x11/win/client.go

View workflow job for this annotation

GitHub Actions / checks

too many arguments in call to c.frame.mousePress

Check failure on line 270 in internal/x11/win/client.go

View workflow job for this annotation

GitHub Actions / platform_tests (1.21, ubuntu-latest)

too many arguments in call to c.frame.mousePress
}

func (c *client) NotifyMouseRelease(x, y int16, b xproto.Button) {
Expand Down
4 changes: 2 additions & 2 deletions internal/x11/win/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@ func (f *frame) createPixmaps(depth byte) error {
xproto.Drawable(f.client.wm.X().Screen().Root), rightWidthPix, heightPix)
f.borderTopRight = pid

backR, backG, backB, _ := theme.DisabledButtonColor().RGBA()
backR, backG, backB, _ := theme.Color(theme.ColorNameDisabledButton).RGBA()
if f.client.Focused() {
backR, backG, backB, _ = theme.BackgroundColor().RGBA()
backR, backG, backB, _ = theme.Color(theme.ColorNameBackground).RGBA()
}
bgColor := uint32(uint8(backR))<<16 | uint32(uint8(backG))<<8 | uint32(uint8(backB))

Expand Down
2 changes: 1 addition & 1 deletion modules/desktops/pager.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (p *pager) refreshFrom(oldID int) {
}

var obj fyne.CanvasObject
obj = canvas.NewRectangle(theme.DisabledColor())
obj = canvas.NewRectangle(theme.Color(theme.ColorNameDisabled))
if win.Properties().Icon() != nil {
obj = container.NewStack(obj,
canvas.NewImageFromResource(win.Properties().Icon()))
Expand Down
4 changes: 2 additions & 2 deletions modules/quaketerm/term.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (t *term) createTerm() {
win := fyne.CurrentApp().Driver().(desktop.Driver).CreateSplashWindow()
win.SetTitle(termTitle)

bg := canvas.NewRectangle(theme.BackgroundColor())
bg := canvas.NewRectangle(theme.Color(theme.ColorNameBackground))
img := canvas.NewImageFromResource(theme.NewDisabledResource(theme.ComputerIcon()))
img.FillMode = canvas.ImageFillContain
img.SetMinSize(fyne.NewSize(200, 200))
Expand Down Expand Up @@ -153,7 +153,7 @@ func matchTheme(bg, over *canvas.Rectangle) {
for {
<-ch

bg.FillColor = theme.BackgroundColor()
bg.FillColor = theme.Color(theme.ColorNameBackground)
bg.Refresh()
over.FillColor = wmTheme.WidgetPanelBackground()
over.Refresh()
Expand Down
6 changes: 3 additions & 3 deletions modules/status/battery.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (b *battery) StatusAreaWidget() fyne.CanvasObject {

b.bar = widget.NewProgressBar()
b.icon = widget.NewIcon(wmtheme.BatteryIcon)
b.fill = canvas.NewRectangle(theme.ForegroundColor())
b.fill = canvas.NewRectangle(theme.Color(theme.ColorNameForeground))
prop := canvas.NewRectangle(color.Transparent)
prop.SetMinSize(b.icon.MinSize().Add(fyne.NewSize(theme.Padding()*4, 0)))
icon := container.NewStack(container.NewCenter(prop, b.icon), container.NewWithoutLayout(b.fill))
Expand All @@ -88,12 +88,12 @@ func (b *battery) setValue(val float64) {
b.fill.Hide()
} else if val < 0.1 {
b.icon.SetResource(theme.NewErrorThemedResource(wmtheme.BatteryIcon))
b.fill.FillColor = theme.ErrorColor()
b.fill.FillColor = theme.Color(theme.ColorNameError)
b.fill.Refresh()
b.fill.Show()
} else {
b.icon.SetResource(wmtheme.BatteryIcon)
b.fill.FillColor = theme.ForegroundColor()
b.fill.FillColor = theme.Color(theme.ColorNameForeground)
b.fill.Refresh()
b.fill.Show()
}
Expand Down
2 changes: 1 addition & 1 deletion wm/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (a *auth) BeginAuthentication(actionID, message, iconName string, details m
layout.NewSpacer()), bottomPad),
nil, nil, f)

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)
Expand Down
10 changes: 5 additions & 5 deletions wm/border.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewBorder(win fynedesk.Window, icon fyne.Resource, canMaximize bool) *Borde
win.Iconify()
}}

title := canvas.NewText(win.Properties().Title(), theme.ForegroundColor())
title := canvas.NewText(win.Properties().Title(), theme.Color(theme.ColorNameForeground))
buttonPos := fynedesk.Instance().Settings().BorderButtonPosition()

var titleBar *Border
Expand Down Expand Up @@ -199,7 +199,7 @@ func (c *Border) makeDesktopMenu(pos fyne.Position) *fyne.MenuItem {
//
// Implements: fyne.Widget
func (c *Border) CreateRenderer() fyne.WidgetRenderer {
render := &coloredBoxRenderer{b: c, bg: canvas.NewRectangle(theme.BackgroundColor())}
render := &coloredBoxRenderer{b: c, bg: canvas.NewRectangle(theme.Color(theme.ColorNameBackground))}
return render
}

Expand Down Expand Up @@ -259,12 +259,12 @@ func (r *coloredBoxRenderer) Objects() []fyne.CanvasObject {
func (r *coloredBoxRenderer) Refresh() {
r.bg.Resize(r.b.Size()) // Not sure why this resize is needed, but it is...
if r.b.win.Focused() {
r.bg.FillColor = theme.BackgroundColor()
r.bg.FillColor = theme.Color(theme.ColorNameBackground)
} else {
r.bg.FillColor = theme.DisabledButtonColor()
r.bg.FillColor = theme.Color(theme.ColorNameDisabledButton)
}
r.bg.Refresh()

r.b.title.Color = theme.ForegroundColor()
r.b.title.Color = theme.Color(theme.ColorNameForeground)
r.b.content.Refresh()
}
2 changes: 1 addition & 1 deletion wm/button.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (c *closeButton) Cursor() desktop.Cursor {
}

func (c *closeButton) MouseIn(*desktop.MouseEvent) {
c.bg.FillColor = theme.ErrorColor()
c.bg.FillColor = theme.Color(theme.ColorNameError)
c.bg.Refresh()
}

Expand Down

0 comments on commit 2f3e91e

Please sign in to comment.