mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-06 00:47:15 -04:00
Use TrueColor color profile as default
Users can override the desired profile by calling WithColorProfile.
This commit is contained in:
+12
-1
@@ -7,6 +7,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/muesli/termenv"
|
||||
"github.com/yuin/goldmark"
|
||||
"github.com/yuin/goldmark/extension"
|
||||
"github.com/yuin/goldmark/parser"
|
||||
@@ -60,7 +61,8 @@ func NewTermRenderer(options ...TermRendererOption) (*TermRenderer, error) {
|
||||
),
|
||||
),
|
||||
ansiOptions: ansi.Options{
|
||||
WordWrap: 80,
|
||||
WordWrap: 80,
|
||||
ColorProfile: termenv.TrueColor,
|
||||
},
|
||||
}
|
||||
for _, o := range options {
|
||||
@@ -87,6 +89,15 @@ func WithBaseURL(baseURL string) TermRendererOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithColorProfile sets the TermRenderer's color profile
|
||||
// (TrueColor / ANSI256 / ANSI).
|
||||
func WithColorProfile(profile termenv.Profile) TermRendererOption {
|
||||
return func(tr *TermRenderer) error {
|
||||
tr.ansiOptions.ColorProfile = profile
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithStandardStyle sets a TermRenderer's styles with a standard (builtin)
|
||||
// style.
|
||||
func WithStandardStyle(style string) TermRendererOption {
|
||||
|
||||
Reference in New Issue
Block a user