2023-12-13 15:10:20 +01:00
|
|
|
// Package display implement functions pertaining to writing formatted
|
|
|
|
// cheatsheet content to stdout, or alternatively the system pager.
|
2020-11-27 19:40:24 +01:00
|
|
|
package display
|
|
|
|
|
2020-11-28 04:50:55 +01:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/cheat/cheat/internal/config"
|
|
|
|
)
|
2020-11-27 19:40:24 +01:00
|
|
|
|
2023-12-13 15:10:20 +01:00
|
|
|
// Faint returns a faintly-colored string that's used to de-prioritize text
|
|
|
|
// written to stdout
|
2020-11-28 04:50:55 +01:00
|
|
|
func Faint(str string, conf config.Config) string {
|
|
|
|
// make `str` faint only if colorization has been requested
|
|
|
|
if conf.Colorize {
|
2022-08-05 02:38:49 +02:00
|
|
|
return fmt.Sprintf("\033[2m%s\033[0m", str)
|
2020-11-28 04:50:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// otherwise, return the string unmodified
|
|
|
|
return str
|
2020-11-27 19:40:24 +01:00
|
|
|
}
|