-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
options.go
25 lines (21 loc) · 845 Bytes
/
options.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
package ansi
// ParseOption specifies parse option.
type ParseOption struct {
ignoreUnexpectedCode bool
ansiForegroundColor string
ansiBackgroundColor string
}
// WithIgnoreInvalidCodes disables returning an error on invalid ANSI code.
func WithIgnoreInvalidCodes() ParseOption {
return ParseOption{ignoreUnexpectedCode: true}
}
// WithDefaultForegroundColor specifies default foreground code (ANSI 39).
// See ColourMap variable and foreground color codes 30-37.
func WithDefaultForegroundColor(ansiColor string) ParseOption {
return ParseOption{ansiForegroundColor: ansiColor}
}
// WithDefaultBackgroundColor specifies default foreground code (ANSI 49).
// See ColourMap variable and foreground color codes 30-37.
func WithDefaultBackgroundColor(ansiColor string) ParseOption {
return ParseOption{ansiBackgroundColor: ansiColor}
}