-
Notifications
You must be signed in to change notification settings - Fork 11
/
styles.go
51 lines (42 loc) · 1.18 KB
/
styles.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package set
import (
"image/color"
"qlova.org/seed"
"qlova.org/seed/use/css"
)
//Style is a setter that wraps css styling.
type Style interface {
seed.Option
Rules() css.Rules
}
//Scrollable sets this to seed to be scrollable if it's height overflows.
//If the container is getting cut off, ensure that a parent seed as MinHeight set to 0.
func Scrollable() Style {
return css.Rules{
css.SetOverflowY(css.Auto),
css.SetOverflowX(css.Hidden),
css.Set("-webkit-overflow-scrolling", "touch"),
css.Set("-webkit-overscroll-behavior", "contain"),
css.Set("overscroll-behavior", "contain"),
}
}
//Color sets the color of this seed.
func Color(c color.Color) Style {
return css.SetBackgroundColor(css.RGB{Color: c})
}
//Opacity sets the transparency of this seed.
func Opacity(v float64) Style {
return css.SetOpacity(css.Number(v))
}
//Clipped sets this seed to clip any children that cross the border.
func Clipped() Style {
return css.SetOverflow(css.Hidden)
}
//Hidden removes this seed from taking space and being visible.
func Hidden() Style {
return css.SetDisplay(css.None)
}
//Visible sets the seed to be visible.
func Visible() css.Rule {
return css.SetDisplay(css.Flex)
}