Checkpoint
This commit is contained in:
160 files changed
+76293
-387
No files matched your search
+132
@@ -0,0 +1,132 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/color"
|
||||
|
||||
"github.com/BeatGlow/beatglow/ui/font"
|
||||
"github.com/BeatGlow/display/pixel"
|
||||
"github.com/mazznoer/colorgrad"
|
||||
)
|
||||
|
||||
type Style struct {
|
||||
Background image.Image
|
||||
Foreground color.Color
|
||||
Gradient colorgrad.Gradient
|
||||
Font *font.Font
|
||||
FontSize float64
|
||||
FontDPI float64
|
||||
}
|
||||
|
||||
type Styles struct {
|
||||
Default Style
|
||||
Boot Style
|
||||
Track Style
|
||||
Format Style
|
||||
Volume Style
|
||||
}
|
||||
|
||||
var (
|
||||
Gray1Style = Styles{
|
||||
Default: Style{
|
||||
Background: image.NewUniform(pixel.Off),
|
||||
Foreground: pixel.On,
|
||||
Font: font.SmoochSans,
|
||||
},
|
||||
Track: Style{
|
||||
Background: image.NewUniform(pixel.Off),
|
||||
Foreground: pixel.On,
|
||||
Font: font.SmoochSans,
|
||||
},
|
||||
Format: Style{
|
||||
Background: image.NewUniform(pixel.Off),
|
||||
Foreground: pixel.On,
|
||||
Font: font.Monaco,
|
||||
},
|
||||
}
|
||||
Gray4Style = Styles{
|
||||
Default: Style{
|
||||
Background: image.NewUniform(pixel.Gray4{}),
|
||||
Foreground: pixel.Gray4{Y: 0xff},
|
||||
Font: font.SmoochSans.WithPointSize(24),
|
||||
FontSize: 24,
|
||||
},
|
||||
Boot: Style{
|
||||
Background: image.NewUniform(pixel.Gray4{}),
|
||||
Foreground: pixel.Gray4{Y: 0xff},
|
||||
Font: font.MairyBlackItalic.WithPointSize(24),
|
||||
FontSize: 24,
|
||||
},
|
||||
Track: Style{
|
||||
Background: image.NewUniform(pixel.Gray4{}),
|
||||
Foreground: pixel.Gray4{Y: 0xff},
|
||||
Font: font.SmoochSans.WithPointSize(24),
|
||||
FontSize: 24,
|
||||
},
|
||||
Format: Style{
|
||||
Background: image.NewUniform(pixel.Gray4{}),
|
||||
Gradient: Gradient("#808080", "#cfcfcf"),
|
||||
Foreground: pixel.Gray4{Y: 0xff},
|
||||
Font: font.Monaco.WithPointSize(9),
|
||||
FontSize: 9,
|
||||
},
|
||||
Volume: Style{
|
||||
Background: image.NewUniform(pixel.Gray4{}),
|
||||
Foreground: pixel.Gray4{Y: 0xff},
|
||||
Font: font.SmoochSans.WithPointSize(24),
|
||||
FontSize: 24,
|
||||
},
|
||||
}
|
||||
DefaultStyle = Styles{
|
||||
Default: Style{
|
||||
Background: image.NewUniform(color.RGBA{R: 0x11, G: 0xff, B: 0xe3, A: 0xff}),
|
||||
Foreground: color.RGBA{R: 0x8a, G: 0x00, B: 0xc4, A: 0xff},
|
||||
Font: font.SmoochSans,
|
||||
},
|
||||
Boot: Style{
|
||||
Background: image.NewUniform(color.RGBA{R: 0x11, G: 0xff, B: 0xe3, A: 0xff}),
|
||||
Foreground: color.RGBA{R: 0x8a, G: 0x00, B: 0xc4, A: 0xff},
|
||||
Font: font.MairyBlackItalic,
|
||||
FontSize: 24,
|
||||
},
|
||||
Track: Style{
|
||||
Background: image.NewUniform(color.RGBA{R: 0x11, G: 0xff, B: 0xe3, A: 0xff}),
|
||||
Foreground: color.RGBA{R: 0x8a, G: 0x00, B: 0xc4, A: 0xff},
|
||||
Font: font.SmoochSans,
|
||||
},
|
||||
Format: Style{
|
||||
Background: image.NewUniform(color.RGBA{R: 0x11, G: 0xff, B: 0xe3, A: 0xff}),
|
||||
Foreground: color.RGBA{R: 0x8a, G: 0x00, B: 0xc4, A: 0xff},
|
||||
Font: font.Monaco,
|
||||
},
|
||||
Volume: Style{
|
||||
Background: image.Black,
|
||||
Foreground: color.White,
|
||||
Font: font.SmoochSans.WithPointSize(24),
|
||||
FontSize: 24,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func Gradient(htmlColors ...string) colorgrad.Gradient {
|
||||
g, err := colorgrad.NewGradient().HtmlColors("#888888", "#cccccc").Build()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return g
|
||||
}
|
||||
|
||||
func Rainbow() colorgrad.Gradient {
|
||||
return colorgrad.Rainbow().Sharp(10, 1.0)
|
||||
}
|
||||
|
||||
func StylesFor(model color.Model) Styles {
|
||||
switch model {
|
||||
case pixel.MonoModel:
|
||||
return Gray1Style
|
||||
case pixel.Gray4Model:
|
||||
return Gray4Style
|
||||
default:
|
||||
return DefaultStyle
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user