Created Icon interface
This commit is contained in:
BIN
theme/assets/wintergreen-icons-small.png
Normal file
BIN
theme/assets/wintergreen-icons-small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -84,14 +84,14 @@ func (Default) FontFace (style FontStyle, size FontSize, c Case) font.Face {
|
||||
}
|
||||
|
||||
// Icon returns an icon from the default set corresponding to the given name.
|
||||
func (Default) Icon (string, IconSize, Case) canvas.Image {
|
||||
func (Default) Icon (string, IconSize, Case) artist.Icon {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
// MimeIcon returns an icon from the default set corresponding to the given mime.
|
||||
// type.
|
||||
func (Default) MimeIcon (data.Mime, IconSize, Case) canvas.Image {
|
||||
func (Default) MimeIcon (data.Mime, IconSize, Case) artist.Icon {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import "image/color"
|
||||
import "golang.org/x/image/font"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/data"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/canvas"
|
||||
|
||||
// IconSize is a type representing valid icon sizes.
|
||||
type IconSize int
|
||||
@@ -148,6 +147,7 @@ type Icon int; const (
|
||||
IconRemoveBookmark
|
||||
IconAddFavorite
|
||||
IconRemoveFavorite
|
||||
|
||||
IconPlay
|
||||
IconPause
|
||||
IconStop
|
||||
@@ -197,11 +197,11 @@ type Theme interface {
|
||||
FontFace (FontStyle, FontSize, Case) font.Face
|
||||
|
||||
// Icon returns an appropriate icon given an icon name, size, and case.
|
||||
Icon (string, IconSize, Case) canvas.Image
|
||||
Icon (string, IconSize, Case) artist.Icon
|
||||
|
||||
// Icon returns an appropriate icon given a file mime type, size, and,
|
||||
// case.
|
||||
MimeIcon (data.Mime, IconSize, Case) canvas.Image
|
||||
MimeIcon (data.Mime, IconSize, Case) artist.Icon
|
||||
|
||||
// Pattern returns an appropriate pattern given a pattern name, case,
|
||||
// and state.
|
||||
|
||||
@@ -5,7 +5,6 @@ import "image/color"
|
||||
import "golang.org/x/image/font"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/data"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/canvas"
|
||||
|
||||
// Wrapped wraps any theme and injects a case into it automatically so that it
|
||||
// doesn't need to be specified for each query. Additionally, if the underlying
|
||||
@@ -22,13 +21,13 @@ func (wrapped Wrapped) FontFace (style FontStyle, size FontSize) font.Face {
|
||||
}
|
||||
|
||||
// Icon returns an appropriate icon given an icon name.
|
||||
func (wrapped Wrapped) Icon (name string, size IconSize) canvas.Image {
|
||||
func (wrapped Wrapped) Icon (name string, size IconSize) artist.Icon {
|
||||
real := wrapped.ensure()
|
||||
return real.Icon(name, size, wrapped.Case)
|
||||
}
|
||||
|
||||
// MimeIcon returns an appropriate icon given file mime type.
|
||||
func (wrapped Wrapped) MimeIcon (mime data.Mime, size IconSize) canvas.Image {
|
||||
func (wrapped Wrapped) MimeIcon (mime data.Mime, size IconSize) artist.Icon {
|
||||
real := wrapped.ensure()
|
||||
return real.MimeIcon(mime, size, wrapped.Case)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user