Checkboxes!
This commit is contained in:
54
theme/button.go
Normal file
54
theme/button.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package theme
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||
|
||||
var buttonPattern = artist.NewMultiBorder (
|
||||
artist.Border { Weight: 1, Stroke: strokePattern },
|
||||
artist.Border {
|
||||
Weight: 1,
|
||||
Stroke: artist.Chiseled {
|
||||
Highlight: artist.NewUniform(hex(0xCCD5D2FF)),
|
||||
Shadow: artist.NewUniform(hex(0x4B5B59FF)),
|
||||
},
|
||||
},
|
||||
artist.Border { Stroke: artist.NewUniform(hex(0x8D9894FF)) })
|
||||
var selectedButtonPattern = artist.NewMultiBorder (
|
||||
artist.Border { Weight: 1, Stroke: strokePattern },
|
||||
artist.Border {
|
||||
Weight: 1,
|
||||
Stroke: artist.Chiseled {
|
||||
Highlight: artist.NewUniform(hex(0xCCD5D2FF)),
|
||||
Shadow: artist.NewUniform(hex(0x4B5B59FF)),
|
||||
},
|
||||
},
|
||||
artist.Border { Weight: 1, Stroke: accentPattern },
|
||||
artist.Border { Stroke: artist.NewUniform(hex(0x8D9894FF)) })
|
||||
var pressedButtonPattern = artist.NewMultiBorder (
|
||||
artist.Border { Weight: 1, Stroke: strokePattern },
|
||||
artist.Border {
|
||||
Weight: 1,
|
||||
Stroke: artist.Chiseled {
|
||||
Highlight: artist.NewUniform(hex(0x4B5B59FF)),
|
||||
Shadow: artist.NewUniform(hex(0x8D9894FF)),
|
||||
},
|
||||
},
|
||||
artist.Border { Stroke: artist.NewUniform(hex(0x8D9894FF)) })
|
||||
var disabledButtonPattern = artist.NewMultiBorder (
|
||||
artist.Border { Weight: 1, Stroke: weakForegroundPattern },
|
||||
artist.Border { Stroke: backgroundPattern })
|
||||
|
||||
func ButtonPattern (enabled, selected, pressed bool) (artist.Pattern) {
|
||||
if enabled {
|
||||
if pressed {
|
||||
return pressedButtonPattern
|
||||
} else {
|
||||
if selected {
|
||||
return selectedButtonPattern
|
||||
} else {
|
||||
return buttonPattern
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return disabledButtonPattern
|
||||
}
|
||||
}
|
||||
@@ -23,41 +23,6 @@ var foregroundPattern = artist.NewUniform(color.Gray16 { 0x0000 })
|
||||
var weakForegroundPattern = artist.NewUniform(color.Gray16 { 0x4444 })
|
||||
var strokePattern = artist.NewUniform(color.Gray16 { 0x0000 })
|
||||
|
||||
var buttonPattern = artist.NewMultiBorder (
|
||||
artist.Border { Weight: 1, Stroke: strokePattern },
|
||||
artist.Border {
|
||||
Weight: 1,
|
||||
Stroke: artist.Chiseled {
|
||||
Highlight: artist.NewUniform(hex(0xCCD5D2FF)),
|
||||
Shadow: artist.NewUniform(hex(0x4B5B59FF)),
|
||||
},
|
||||
},
|
||||
artist.Border { Stroke: artist.NewUniform(hex(0x8D9894FF)) })
|
||||
var selectedButtonPattern = artist.NewMultiBorder (
|
||||
artist.Border { Weight: 1, Stroke: strokePattern },
|
||||
artist.Border {
|
||||
Weight: 1,
|
||||
Stroke: artist.Chiseled {
|
||||
Highlight: artist.NewUniform(hex(0xCCD5D2FF)),
|
||||
Shadow: artist.NewUniform(hex(0x4B5B59FF)),
|
||||
},
|
||||
},
|
||||
artist.Border { Weight: 1, Stroke: accentPattern },
|
||||
artist.Border { Stroke: artist.NewUniform(hex(0x8D9894FF)) })
|
||||
var pressedButtonPattern = artist.NewMultiBorder (
|
||||
artist.Border { Weight: 1, Stroke: strokePattern },
|
||||
artist.Border {
|
||||
Weight: 1,
|
||||
Stroke: artist.Chiseled {
|
||||
Highlight: artist.NewUniform(hex(0x4B5B59FF)),
|
||||
Shadow: artist.NewUniform(hex(0x8D9894FF)),
|
||||
},
|
||||
},
|
||||
artist.Border { Stroke: artist.NewUniform(hex(0x8D9894FF)) })
|
||||
var disabledButtonPattern = artist.NewMultiBorder (
|
||||
artist.Border { Weight: 1, Stroke: weakForegroundPattern },
|
||||
artist.Border { Stroke: backgroundPattern })
|
||||
|
||||
var sunkenPattern = artist.NewMultiBorder (
|
||||
artist.Border { Weight: 1, Stroke: strokePattern },
|
||||
artist.Border {
|
||||
@@ -79,21 +44,6 @@ func ForegroundPattern (enabled bool) (artist.Pattern) {
|
||||
return weakForegroundPattern
|
||||
}
|
||||
}
|
||||
func ButtonPattern (enabled, selected, pressed bool) (artist.Pattern) {
|
||||
if enabled {
|
||||
if pressed {
|
||||
return pressedButtonPattern
|
||||
} else {
|
||||
if selected {
|
||||
return selectedButtonPattern
|
||||
} else {
|
||||
return buttonPattern
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return disabledButtonPattern
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: load fonts from an actual source instead of using defaultfont
|
||||
|
||||
|
||||
Reference in New Issue
Block a user