Added a case specifier to the theme API

This will allow themes to pull off some cool dirty tricks without
screwing anything up
This commit is contained in:
2023-01-30 01:30:13 -05:00
parent 2c55824920
commit 174beba79f
12 changed files with 147 additions and 31 deletions

View File

@@ -7,6 +7,8 @@ import "git.tebibyte.media/sashakoshka/tomo/theme"
import "git.tebibyte.media/sashakoshka/tomo/artist"
import "git.tebibyte.media/sashakoshka/tomo/elements/core"
var clockCase = theme.C("fun", "clock")
// AnalogClock can display the time of day in an analog format.
type AnalogClock struct {
*core.Core
@@ -41,13 +43,19 @@ func (element *AnalogClock) SetTime (newTime time.Time) {
func (element *AnalogClock) draw () {
bounds := element.core.Bounds()
pattern, inset := theme.SunkenPattern(theme.PatternState { })
pattern, inset := theme.SunkenPattern(theme.PatternState {
Case: clockCase,
})
artist.FillRectangle(element, pattern, bounds)
bounds = inset.Apply(bounds)
foreground, _ := theme.ForegroundPattern(theme.PatternState { })
accent, _ := theme.AccentPattern(theme.PatternState { })
foreground, _ := theme.ForegroundPattern(theme.PatternState {
Case: clockCase,
})
accent, _ := theme.AccentPattern(theme.PatternState {
Case: clockCase,
})
for hour := 0; hour < 12; hour ++ {
element.radialLine (