-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcell.go
54 lines (47 loc) · 1.45 KB
/
cell.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
52
53
54
package dull
type CellOptions struct {
Fg Color
Bg Color
Bold bool
Italic bool
Underline bool
Strikethrough bool
Invert bool
}
// Cell represents a single cell in a grid of Cells, that are displayed in a window.
//
// Fields in a Cell may be modified in a callback that runs on the main thread.
// Do not modify the cells outside of a mainthread callback.
//
// If any fields are modified, then the containing window's MarkDirty must be called.
type Cell struct {
// Rune is the Rune to be rendered.
Rune rune
// Fg is the foreground colour, used to render the Rune.
Fg Color
// Bg is the background colour, used to fill the cell's background.
Bg Color
// Bold denotes whether the Rune is rendered in Bold.
// May be combined with Italic.
Bold bool
// Italic denotes whether the Rune is rendered italicised.
// May be combined with Bold.
Italic bool
// Underline denotes whether the Rune should be underlined (underscored).
Underline bool
// Strikethrough denotes whether the Rune should be struckthrough.
Strikethrough bool
// Invert denotes whether the foreground and background colours should be reversed.
Invert bool
grid *CellGrid
vertices []float32
}
func (c *Cell) ApplyOptions(options *CellOptions) {
c.Fg = options.Fg
c.Bg = options.Bg
c.Bold = options.Bold
c.Invert = options.Invert
c.Italic = options.Italic
c.Strikethrough = options.Strikethrough
c.Underline = options.Underline
}