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

@@ -3,10 +3,28 @@ package theme
import "image"
import "git.tebibyte.media/sashakoshka/tomo/artist"
// Case sepecifies what kind of element is using a pattern. It contains a
// namespace parameter and an element parameter. The element parameter does not
// necissarily need to match an element name, but if it can, it should. Both
// parameters should be written in camel case. Themes can change their styling
// based on this parameter for fine-grained control over the look and feel of
// specific elements.
type Case struct { Namespace, Element string }
// C can be used as shorthand to generate a case struct as used in PatternState.
func C (namespace, element string) (c Case) {
return Case {
Namespace: namespace,
Element: element,
}
}
// PatternState lists parameters which can change the appearance of some
// patterns. For example, passing a PatternState with Selected set to true may
// result in a pattern that has a colored border within it.
type PatternState struct {
Case
// On should be set to true if the element that is using this pattern is
// in some sort of "on" state, such as if a checkbox is checked or a
// switch is toggled on. This is only necessary if the element in