Skip to content

Commit

Permalink
Merge pull request #4203 from andydotxyz/fix/4199
Browse files Browse the repository at this point in the history
Use transparency around colour wheel
  • Loading branch information
andydotxyz authored Aug 28, 2023
2 parents 8b4fd1e + db522b5 commit 31e5985
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions dialog/color.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ func newCheckeredBackground(radial bool) *canvas.Raster {
rect := f
f = func(x, y, w, h int) color.Color {
r, t := cmplx.Polar(complex(float64(x)-float64(w)/2, float64(y)-float64(h)/2))
limit := math.Min(float64(w), float64(h)) / 2.0
if r > limit {
// Out of bounds
return &color.NRGBA{A: 0}
}

x = int((t + math.Pi) / (2 * math.Pi) * checkeredNumberOfRings * checkeredBoxSize)
y = int(r)
return rect(x, y, 0, 0)
Expand Down
2 changes: 1 addition & 1 deletion dialog/color_wheel.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (a *colorWheel) colorAt(x, y, w, h int) color.Color {
limit := math.Min(width, height) / 2.0
if radius > limit {
// Out of bounds
return theme.BackgroundColor()
return color.Transparent
}
degrees := radians * (180.0 / math.Pi)
hue := wrapHue(int(degrees))
Expand Down
Binary file modified dialog/testdata/color/dialog_expanded_theme_default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/color/dialog_expanded_theme_ugly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 31e5985

Please sign in to comment.