2023-01-08 23:03:19 -07:00
|
|
|
package theme
|
|
|
|
|
|
|
|
import "image"
|
|
|
|
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.
|
|
|
|
|
2023-01-09 13:14:36 -07:00
|
|
|
var foregroundImage = artist.NewUniform(color.Gray16 { 0x0000})
|
2023-01-08 23:03:19 -07:00
|
|
|
var disabledForegroundImage = artist.NewUniform(color.Gray16 { 0x5555})
|
2023-01-11 13:46:48 -07:00
|
|
|
var accentImage = artist.NewUniform(color.RGBA { 0x40, 0x80, 0x90, 0xFF})
|
2023-01-09 13:14:36 -07:00
|
|
|
var highlightImage = artist.NewUniform(color.Gray16 { 0xEEEE })
|
|
|
|
var shadowImage = artist.NewUniform(color.Gray16 { 0x3333 })
|
|
|
|
var weakShadeImage = artist.NewUniform(color.Gray16 { 0x7777 })
|
|
|
|
var strokeImage = artist.NewUniform(color.Gray16 { 0x0000 })
|
|
|
|
var weakStrokeImage = artist.NewUniform(color.Gray16 { 0x3333 })
|
|
|
|
var insetShadowImage = artist.NewUniform(color.Gray16 { 0x7777 })
|
2023-01-08 23:03:19 -07:00
|
|
|
|
|
|
|
var backgroundImage = artist.NewUniform(color.Gray16 { 0xAAAA})
|
|
|
|
var backgroundProfile = artist.ShadingProfile {
|
|
|
|
Highlight: highlightImage,
|
|
|
|
Shadow: shadowImage,
|
2023-01-11 13:46:48 -07:00
|
|
|
Stroke: strokeImage,
|
2023-01-08 23:03:19 -07:00
|
|
|
Fill: backgroundImage,
|
|
|
|
StrokeWeight: 1,
|
|
|
|
ShadingWeight: 1,
|
|
|
|
}
|
|
|
|
var engravedBackgroundProfile = backgroundProfile.Engraved()
|
|
|
|
|
|
|
|
var raisedImage = artist.NewUniform(color.RGBA { 0x8D, 0x98, 0x94, 0xFF})
|
|
|
|
var raisedProfile = artist.ShadingProfile {
|
|
|
|
Highlight: highlightImage,
|
|
|
|
Shadow: shadowImage,
|
2023-01-09 13:14:36 -07:00
|
|
|
Stroke: strokeImage,
|
|
|
|
Fill: raisedImage,
|
|
|
|
StrokeWeight: 1,
|
|
|
|
ShadingWeight: 1,
|
|
|
|
}
|
|
|
|
var selectedRaisedProfile = artist.ShadingProfile {
|
|
|
|
Highlight: highlightImage,
|
|
|
|
Shadow: shadowImage,
|
|
|
|
Stroke: accentImage,
|
2023-01-08 23:03:19 -07:00
|
|
|
Fill: raisedImage,
|
|
|
|
StrokeWeight: 1,
|
|
|
|
ShadingWeight: 1,
|
|
|
|
}
|
|
|
|
var engravedRaisedProfile = artist.ShadingProfile {
|
2023-01-09 13:14:36 -07:00
|
|
|
Highlight: weakShadeImage,
|
2023-01-08 23:03:19 -07:00
|
|
|
Shadow: raisedImage,
|
2023-01-09 13:14:36 -07:00
|
|
|
Stroke: strokeImage,
|
2023-01-08 23:03:19 -07:00
|
|
|
Fill: raisedImage,
|
|
|
|
StrokeWeight: 1,
|
|
|
|
ShadingWeight: 1,
|
|
|
|
}
|
2023-01-09 13:14:36 -07:00
|
|
|
var selectedEngravedRaisedProfile = artist.ShadingProfile {
|
|
|
|
Highlight: insetShadowImage,
|
|
|
|
Shadow: raisedImage,
|
|
|
|
Stroke: accentImage,
|
2023-01-08 23:03:19 -07:00
|
|
|
Fill: raisedImage,
|
|
|
|
StrokeWeight: 1,
|
2023-01-09 13:14:36 -07:00
|
|
|
ShadingWeight: 1,
|
|
|
|
}
|
|
|
|
var disabledRaisedProfile = artist.ShadingProfile {
|
|
|
|
Highlight: weakShadeImage,
|
|
|
|
Shadow: weakShadeImage,
|
|
|
|
Stroke: weakStrokeImage,
|
|
|
|
Fill: backgroundImage,
|
|
|
|
StrokeWeight: 1,
|
2023-01-08 23:03:19 -07:00
|
|
|
ShadingWeight: 0,
|
|
|
|
}
|
|
|
|
|
|
|
|
var inputImage = artist.NewUniform(color.Gray16 { 0xFFFF })
|
|
|
|
var inputProfile = artist.ShadingProfile {
|
2023-01-09 13:14:36 -07:00
|
|
|
Highlight: insetShadowImage,
|
|
|
|
Shadow: inputImage,
|
|
|
|
Stroke: strokeImage,
|
2023-01-08 23:03:19 -07:00
|
|
|
Fill: inputImage,
|
|
|
|
StrokeWeight: 1,
|
|
|
|
ShadingWeight: 1,
|
|
|
|
}
|
2023-01-09 13:14:36 -07:00
|
|
|
var selectedInputProfile = artist.ShadingProfile {
|
|
|
|
Highlight: insetShadowImage,
|
|
|
|
Shadow: inputImage,
|
|
|
|
Stroke: accentImage,
|
2023-01-08 23:03:19 -07:00
|
|
|
Fill: inputImage,
|
|
|
|
StrokeWeight: 1,
|
2023-01-09 13:14:36 -07:00
|
|
|
ShadingWeight: 1,
|
|
|
|
}
|
|
|
|
var disabledInputProfile = artist.ShadingProfile {
|
|
|
|
Highlight: weakShadeImage,
|
|
|
|
Shadow: backgroundImage,
|
|
|
|
Stroke: accentImage,
|
|
|
|
Fill: backgroundImage,
|
|
|
|
StrokeWeight: 1,
|
2023-01-08 23:03:19 -07:00
|
|
|
ShadingWeight: 0,
|
|
|
|
}
|
|
|
|
|
|
|
|
// BackgroundProfile returns the shading profile to be used for backgrounds.
|
|
|
|
func BackgroundProfile (engraved bool) artist.ShadingProfile {
|
|
|
|
if engraved {
|
|
|
|
return engravedBackgroundProfile
|
|
|
|
} else {
|
|
|
|
return backgroundProfile
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// RaisedProfile returns the shading profile to be used for raised objects such
|
|
|
|
// as buttons.
|
2023-01-09 13:14:36 -07:00
|
|
|
func RaisedProfile (
|
|
|
|
engraved bool,
|
|
|
|
enabled bool,
|
|
|
|
selected bool,
|
|
|
|
) (
|
|
|
|
artist.ShadingProfile,
|
|
|
|
) {
|
2023-01-08 23:03:19 -07:00
|
|
|
if enabled {
|
|
|
|
if engraved {
|
2023-01-09 13:14:36 -07:00
|
|
|
if selected {
|
|
|
|
return selectedEngravedRaisedProfile
|
|
|
|
} else {
|
|
|
|
return engravedRaisedProfile
|
|
|
|
}
|
2023-01-08 23:03:19 -07:00
|
|
|
} else {
|
2023-01-09 13:14:36 -07:00
|
|
|
if selected {
|
|
|
|
return selectedRaisedProfile
|
|
|
|
} else {
|
|
|
|
return raisedProfile
|
|
|
|
}
|
2023-01-08 23:03:19 -07:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return disabledRaisedProfile
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// InputProfile returns the shading profile to be used for input fields.
|
2023-01-09 13:14:36 -07:00
|
|
|
func InputProfile (enabled bool, selected bool) artist.ShadingProfile {
|
2023-01-08 23:03:19 -07:00
|
|
|
if enabled {
|
2023-01-09 13:14:36 -07:00
|
|
|
if selected {
|
|
|
|
return selectedInputProfile
|
|
|
|
} else {
|
|
|
|
return inputProfile
|
|
|
|
}
|
2023-01-08 23:03:19 -07:00
|
|
|
} else {
|
|
|
|
return disabledInputProfile
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// BackgroundImage returns the texture/color used for the fill of
|
|
|
|
// BackgroundProfile.
|
2023-01-13 23:54:57 -07:00
|
|
|
func BackgroundImage () artist.Pattern {
|
2023-01-08 23:03:19 -07:00
|
|
|
return backgroundImage
|
|
|
|
}
|
|
|
|
|
|
|
|
// RaisedImage returns the texture/color used for the fill of RaisedProfile.
|
2023-01-13 23:54:57 -07:00
|
|
|
func RaisedImage () artist.Pattern {
|
2023-01-08 23:03:19 -07:00
|
|
|
return raisedImage
|
|
|
|
}
|
|
|
|
|
|
|
|
// InputImage returns the texture/color used for the fill of InputProfile.
|
2023-01-13 23:54:57 -07:00
|
|
|
func InputImage () artist.Pattern {
|
2023-01-08 23:03:19 -07:00
|
|
|
return inputImage
|
|
|
|
}
|
|
|
|
|
|
|
|
// ForegroundImage returns the texture/color text and monochromatic icons should
|
|
|
|
// be drawn with.
|
2023-01-13 23:54:57 -07:00
|
|
|
func ForegroundImage () artist.Pattern {
|
2023-01-08 23:03:19 -07:00
|
|
|
return foregroundImage
|
|
|
|
}
|
|
|
|
|
|
|
|
// DisabledForegroundImage returns the texture/color text and monochromatic
|
|
|
|
// icons should be drawn with if they are disabled.
|
2023-01-13 23:54:57 -07:00
|
|
|
func DisabledForegroundImage () artist.Pattern {
|
2023-01-08 23:03:19 -07:00
|
|
|
return disabledForegroundImage
|
|
|
|
}
|
|
|
|
|
|
|
|
// AccentImage returns the accent texture/color.
|
2023-01-13 23:54:57 -07:00
|
|
|
func AccentImage () artist.Pattern {
|
2023-01-08 23:03:19 -07:00
|
|
|
return accentImage
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: load fonts from an actual source instead of using basicfont
|
|
|
|
|
|
|
|
// 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 how spaced out things should be on the screen. Generally,
|
|
|
|
// text should be offset from its container on all sides by this amount.
|
|
|
|
func Padding () int {
|
|
|
|
return 8
|
|
|
|
}
|
|
|
|
|
|
|
|
// SinkOffsetVector specifies a vector for things such as text to move by when a
|
|
|
|
// "sinking in" effect is desired, such as a button label during a button press.
|
|
|
|
func SinkOffsetVector () image.Point {
|
|
|
|
return image.Point { 1, 1 }
|
|
|
|
}
|