The theming around List makes slightly more sense

This commit is contained in:
2023-01-30 02:22:16 -05:00
parent 174beba79f
commit 35870951a2
6 changed files with 60 additions and 41 deletions

View File

@@ -18,23 +18,11 @@ var selectedListPattern = artist.NewMultiBordered (
artist.Stroke { Weight: 1, Pattern: accentPattern },
artist.Stroke { Pattern: artist.NewUniform(hex(0x999C99FF)) })
// TODO: make these better, making use of the padded pattern. also, create
// selected variations for both of these.
var listEntryPattern = artist.NewMultiBordered (
artist.Stroke { Weight: 1, Pattern: artist.QuadBeveled {
artist.NewUniform(hex(0x999C99FF)),
strokePattern,
artist.NewUniform(hex(0x999C99FF)),
strokePattern,
}},
artist.Stroke { Pattern: artist.NewUniform(hex(0x999C99FF)) })
var selectedListEntryPattern = artist.NewMultiBordered (
artist.Stroke { Weight: 1, Pattern: strokePattern },
artist.Stroke {
Weight: 1,
Pattern: artist.Beveled {
artist.NewUniform(hex(0x3b534eFF)),
artist.NewUniform(hex(0x97a09cFF)),
},
},
artist.Stroke { Pattern: artist.NewUniform(hex(0x97a09cFF)) })
var onListEntryPattern = artist.NewMultiBordered (
artist.Stroke { Pattern: artist.NewUniform(hex(0x6e8079FF)) })

View File

@@ -63,7 +63,7 @@ type Inset [4]int
// further, an empty rectangle near its center will be returned.
func (inset Inset) Apply (bigger image.Rectangle) (smaller image.Rectangle) {
smaller = bigger
if smaller.Dx() < inset[3] + inset[0] {
if smaller.Dx() < inset[3] + inset[1] {
smaller.Min.X = (smaller.Min.X + smaller.Max.X) / 2
smaller.Max.X = smaller.Min.X
} else {
@@ -71,7 +71,7 @@ func (inset Inset) Apply (bigger image.Rectangle) (smaller image.Rectangle) {
smaller.Max.X -= inset[1]
}
if smaller.Dy() < inset[1] + inset[2] {
if smaller.Dy() < inset[0] + inset[2] {
smaller.Min.Y = (smaller.Min.Y + smaller.Max.Y) / 2
smaller.Max.Y = smaller.Min.Y
} else {
@@ -131,24 +131,21 @@ func InputPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
}
}
// TODO: for list and item patterns, have all that bizarre padding/2 information
// in the insets.
// ListPattern returns a background pattern for a list of things.
func ListPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
if state.Selected {
return selectedListPattern, Inset { 4, 0, 4, 0 }
return selectedListPattern, Inset { 4, 4, 4, 4 }
} else {
return listPattern, Inset { 4, 0, 4, 0 }
return listPattern, Inset { 4, 4, 4, 4 }
}
}
// ItemPattern returns a background pattern for a list item.
func ItemPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
if state.On {
return selectedListEntryPattern, Inset { 4, 8, 4, 8 }
return onListEntryPattern, Inset { 4, 4, 4, 4 }
} else {
return listEntryPattern, Inset { 4, 8, 4, 8 }
return listEntryPattern, Inset { 4, 4, 4, 4 }
}
}