Removed most of stuff that will be replaced
This commit is contained in:
parent
0c5cc6ff74
commit
0667cf1b27
@ -1,48 +0,0 @@
|
||||
package theme
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||
|
||||
var buttonPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
artist.NewUniform(hex(0xCCD5D2FF)),
|
||||
artist.NewUniform(hex(0x4B5B59FF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x8D9894FF)) })
|
||||
var selectedButtonPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
artist.NewUniform(hex(0xCCD5D2FF)),
|
||||
artist.NewUniform(hex(0x4B5B59FF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Weight: 1, Pattern: accentPattern },
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x8D9894FF)) })
|
||||
var pressedButtonPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
artist.NewUniform(hex(0x4B5B59FF)),
|
||||
artist.NewUniform(hex(0x8D9894FF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x8D9894FF)) })
|
||||
var pressedSelectedButtonPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
artist.NewUniform(hex(0x4B5B59FF)),
|
||||
artist.NewUniform(hex(0x8D9894FF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x8D9894FF)) })
|
||||
var disabledButtonPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: weakForegroundPattern },
|
||||
artist.Stroke { Pattern: backgroundPattern })
|
@ -1,21 +0,0 @@
|
||||
package theme
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||
|
||||
var inputPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
artist.NewUniform(hex(0x89925AFF)),
|
||||
artist.NewUniform(hex(0xD2CB9AFF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0xD2CB9AFF)) })
|
||||
var selectedInputPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke { Weight: 1, Pattern: accentPattern },
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0xD2CB9AFF)) })
|
||||
var disabledInputPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: weakForegroundPattern },
|
||||
artist.Stroke { Pattern: backgroundPattern })
|
@ -1,43 +0,0 @@
|
||||
package theme
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||
|
||||
var listPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
uhex(0x383C3AFF),
|
||||
uhex(0x999C99FF),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Pattern: uhex(0x999C99FF) })
|
||||
|
||||
var focusedListPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke { Weight: 1, Pattern: accentPattern },
|
||||
artist.Stroke { Pattern: uhex(0x999C99FF) })
|
||||
|
||||
var listEntryPattern = artist.Padded {
|
||||
Stroke: uhex(0x383C3AFF),
|
||||
Fill: uhex(0x999C99FF),
|
||||
Sides: []int { 0, 0, 0, 1 },
|
||||
}
|
||||
|
||||
var onListEntryPattern = artist.Padded {
|
||||
Stroke: uhex(0x383C3AFF),
|
||||
Fill: uhex(0x6e8079FF),
|
||||
Sides: []int { 0, 0, 0, 1 },
|
||||
}
|
||||
|
||||
var focusedListEntryPattern = artist.Padded {
|
||||
Stroke: accentPattern,
|
||||
Fill: uhex(0x999C99FF),
|
||||
Sides: []int { 0, 1, 0, 1 },
|
||||
}
|
||||
|
||||
var focusedOnListEntryPattern = artist.Padded {
|
||||
Stroke: accentPattern,
|
||||
Fill: uhex(0x6e8079FF),
|
||||
Sides: []int { 0, 1, 0, 1 },
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
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
|
||||
@ -90,150 +89,3 @@ func (inset Inset) Inverse () (prime Inset) {
|
||||
inset[3] * -1,
|
||||
}
|
||||
}
|
||||
|
||||
// AccentPattern returns the accent pattern, which is usually just a solid
|
||||
// color.
|
||||
func AccentPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
|
||||
return accentPattern, Inset { }
|
||||
}
|
||||
|
||||
// BackgroundPattern returns the main background pattern.
|
||||
func BackgroundPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
|
||||
return backgroundPattern, Inset { }
|
||||
}
|
||||
|
||||
// DeadPattern returns a pattern that can be used to mark an area or gap that
|
||||
// serves no purpose, but still needs aesthetic structure.
|
||||
func DeadPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
|
||||
return deadPattern, Inset { }
|
||||
}
|
||||
|
||||
// ForegroundPattern returns the color text should be.
|
||||
func ForegroundPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
|
||||
if state.Disabled {
|
||||
return weakForegroundPattern, Inset { }
|
||||
} else {
|
||||
return foregroundPattern, Inset { }
|
||||
}
|
||||
}
|
||||
|
||||
// InputPattern returns a background pattern for any input field that can be
|
||||
// edited by typing with the keyboard.
|
||||
func InputPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
|
||||
if state.Disabled {
|
||||
return disabledInputPattern, Inset { 1, 1, 1, 1 }
|
||||
} else {
|
||||
if state.Focused {
|
||||
return selectedInputPattern, Inset { 1, 1, 1, 1 }
|
||||
} else {
|
||||
return inputPattern, Inset { 1, 1, 1, 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ListPattern returns a background pattern for a list of things.
|
||||
func ListPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
|
||||
if state.Focused {
|
||||
pattern = focusedListPattern
|
||||
inset = Inset { 2, 1, 2, 1 }
|
||||
} else {
|
||||
pattern = listPattern
|
||||
inset = Inset { 2, 1, 1, 1 }
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ItemPattern returns a background pattern for a list item.
|
||||
func ItemPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
|
||||
if state.Focused {
|
||||
if state.On {
|
||||
pattern = focusedOnListEntryPattern
|
||||
} else {
|
||||
pattern = focusedListEntryPattern
|
||||
}
|
||||
} else {
|
||||
if state.On {
|
||||
pattern = onListEntryPattern
|
||||
} else {
|
||||
pattern = listEntryPattern
|
||||
}
|
||||
}
|
||||
inset = Inset { 4, 6, 4, 6 }
|
||||
return
|
||||
}
|
||||
|
||||
// ButtonPattern returns a pattern to be displayed on buttons.
|
||||
func ButtonPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
|
||||
if state.Disabled {
|
||||
return disabledButtonPattern, Inset { 1, 1, 1, 1 }
|
||||
} else {
|
||||
if state.Pressed {
|
||||
if state.Focused {
|
||||
return pressedSelectedButtonPattern, Inset {
|
||||
2, 0, 0, 2 }
|
||||
} else {
|
||||
return pressedButtonPattern, Inset { 2, 0, 0, 2 }
|
||||
}
|
||||
} else {
|
||||
if state.Focused {
|
||||
return selectedButtonPattern, Inset { 1, 1, 1, 1 }
|
||||
} else {
|
||||
return buttonPattern, Inset { 1, 1, 1, 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GutterPattern returns a pattern to be used to mark a track along which
|
||||
// something slides.
|
||||
func GutterPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
|
||||
if state.Disabled {
|
||||
return disabledScrollGutterPattern, Inset { 0, 0, 0, 0 }
|
||||
} else {
|
||||
return scrollGutterPattern, Inset { 0, 0, 0, 0 }
|
||||
}
|
||||
}
|
||||
|
||||
// HandlePattern returns a pattern to be displayed on a grab handle that slides
|
||||
// along a gutter.
|
||||
func HandlePattern (state PatternState) (pattern artist.Pattern, inset Inset) {
|
||||
if state.Disabled {
|
||||
return disabledScrollBarPattern, Inset { 1, 1, 1, 1 }
|
||||
} else {
|
||||
if state.Focused {
|
||||
if state.Pressed {
|
||||
return pressedSelectedScrollBarPattern, Inset { 1, 1, 1, 1 }
|
||||
} else {
|
||||
return selectedScrollBarPattern, Inset { 1, 1, 1, 1 }
|
||||
}
|
||||
} else {
|
||||
if state.Pressed {
|
||||
return pressedScrollBarPattern, Inset { 1, 1, 1, 1 }
|
||||
} else {
|
||||
return scrollBarPattern, Inset { 1, 1, 1, 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SunkenPattern returns a general purpose pattern that is sunken/engraved into
|
||||
// the background.
|
||||
func SunkenPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
|
||||
return sunkenPattern, Inset { 1, 1, 1, 1 }
|
||||
}
|
||||
|
||||
// RaisedPattern returns a general purpose pattern that is raised up out of the
|
||||
// background.
|
||||
func RaisedPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
|
||||
if state.Focused {
|
||||
return selectedRaisedPattern, Inset { 1, 1, 1, 1 }
|
||||
} else {
|
||||
return raisedPattern, Inset { 1, 1, 1, 1 }
|
||||
}
|
||||
}
|
||||
|
||||
// PinboardPattern returns a textured backdrop pattern. Anything drawn within it
|
||||
// should have its own background pattern.
|
||||
func PinboardPattern (state PatternState) (pattern artist.Pattern, inset Inset) {
|
||||
return texturedSunkenPattern, Inset { 1, 1, 1, 1 }
|
||||
}
|
||||
|
@ -1,63 +0,0 @@
|
||||
package theme
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||
|
||||
var scrollGutterPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
artist.NewUniform(hex(0x3b534eFF)),
|
||||
artist.NewUniform(hex(0x6e8079FF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x6e8079FF)) })
|
||||
var disabledScrollGutterPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: weakForegroundPattern },
|
||||
artist.Stroke { Pattern: backgroundPattern })
|
||||
var scrollBarPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
artist.NewUniform(hex(0xCCD5D2FF)),
|
||||
artist.NewUniform(hex(0x4B5B59FF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x8D9894FF)) })
|
||||
var selectedScrollBarPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
artist.NewUniform(hex(0xCCD5D2FF)),
|
||||
artist.NewUniform(hex(0x4B5B59FF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Weight: 1, Pattern: accentPattern },
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x8D9894FF)) })
|
||||
var pressedScrollBarPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
artist.NewUniform(hex(0xCCD5D2FF)),
|
||||
artist.NewUniform(hex(0x4B5B59FF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Weight: 1, Pattern: artist.NewUniform(hex(0x8D9894FF)) },
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x7f8c89FF)) })
|
||||
var pressedSelectedScrollBarPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
artist.NewUniform(hex(0xCCD5D2FF)),
|
||||
artist.NewUniform(hex(0x4B5B59FF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Weight: 1, Pattern: accentPattern },
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x7f8c89FF)) })
|
||||
var disabledScrollBarPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: weakForegroundPattern },
|
||||
artist.Stroke { Pattern: backgroundPattern })
|
111
theme/theme.go
111
theme/theme.go
@ -1,116 +1,5 @@
|
||||
package theme
|
||||
|
||||
import "image/color"
|
||||
import "golang.org/x/image/font"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/defaultfont"
|
||||
|
||||
// none of these colors are final! TODO: generate these values from a theme
|
||||
// file at startup.
|
||||
|
||||
func hex (color uint32) (c color.RGBA) {
|
||||
c.A = uint8(color)
|
||||
c.B = uint8(color >> 8)
|
||||
c.G = uint8(color >> 16)
|
||||
c.R = uint8(color >> 24)
|
||||
return
|
||||
}
|
||||
|
||||
func uhex (color uint32) (pattern artist.Pattern) {
|
||||
return artist.NewUniform(hex(color))
|
||||
}
|
||||
|
||||
var accentPattern = artist.NewUniform(hex(0x408090FF))
|
||||
var backgroundPattern = artist.NewUniform(color.Gray16 { 0xAAAA })
|
||||
var foregroundPattern = artist.NewUniform(color.Gray16 { 0x0000 })
|
||||
var weakForegroundPattern = artist.NewUniform(color.Gray16 { 0x4444 })
|
||||
var strokePattern = artist.NewUniform(color.Gray16 { 0x0000 })
|
||||
|
||||
var sunkenPattern = 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 texturedSunkenPattern = 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.Striped {
|
||||
// First: artist.Stroke {
|
||||
// Weight: 2,
|
||||
// Pattern: artist.NewUniform(hex(0x97a09cFF)),
|
||||
// },
|
||||
// Second: artist.Stroke {
|
||||
// Weight: 1,
|
||||
// Pattern: artist.NewUniform(hex(0x6e8079FF)),
|
||||
// },
|
||||
// }})
|
||||
|
||||
artist.Stroke { Pattern: artist.Noisy {
|
||||
Low: artist.NewUniform(hex(0x97a09cFF)),
|
||||
High: artist.NewUniform(hex(0x6e8079FF)),
|
||||
}})
|
||||
|
||||
var raisedPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
artist.NewUniform(hex(0xDBDBDBFF)),
|
||||
artist.NewUniform(hex(0x383C3AFF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0xAAAAAAFF)) })
|
||||
|
||||
var selectedRaisedPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
artist.NewUniform(hex(0xDBDBDBFF)),
|
||||
artist.NewUniform(hex(0x383C3AFF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Weight: 1, Pattern: accentPattern },
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0xAAAAAAFF)) })
|
||||
|
||||
var deadPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x97a09cFF)) })
|
||||
|
||||
// TODO: load fonts from an actual source instead of using defaultfont
|
||||
|
||||
// FontFaceRegular returns the font face to be used for normal text.
|
||||
func FontFaceRegular () font.Face {
|
||||
return defaultfont.FaceRegular
|
||||
}
|
||||
|
||||
// FontFaceBold returns the font face to be used for bolded text.
|
||||
func FontFaceBold () font.Face {
|
||||
return defaultfont.FaceBold
|
||||
}
|
||||
|
||||
// FontFaceItalic returns the font face to be used for italicized text.
|
||||
func FontFaceItalic () font.Face {
|
||||
return defaultfont.FaceItalic
|
||||
}
|
||||
|
||||
// FontFaceBoldItalic returns the font face to be used for text that is both
|
||||
// bolded and italicized.
|
||||
func FontFaceBoldItalic () font.Face {
|
||||
return defaultfont.FaceBoldItalic
|
||||
}
|
||||
|
||||
// Padding returns the amount of internal padding elements should have. An
|
||||
// element's inner content (such as text) should be inset by this amount,
|
||||
|
Reference in New Issue
Block a user