style.go 554 B

1234567891011121314151617181920212223242526272829303132
  1. package style
  2. import (
  3. "fmt"
  4. )
  5. /*
  6. To, e.g., bold, prepend the bold character,
  7. then substitute all resets with `${reset}${bold}`
  8. to force rebold after all resets, to make sure. Might
  9. be complex with layering
  10. */
  11. // const (
  12. // Bold =
  13. // )
  14. func Display(text string, code int) string {
  15. return fmt.Sprintf("\x1b[%dm%s\x1b[0m", code, text)
  16. }
  17. func Bold(text string) string {
  18. return Display(text, 1)
  19. }
  20. // func Underline(text string) string {
  21. // return Display(text, )
  22. // }
  23. // func Anchor(text string) string {
  24. // }