You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

colours.go 768B

12345678910111213141516171819202122232425262728293031323334
  1. package dispatcher
  2. import "strings"
  3. var colourMap map[string]string = map[string]string{
  4. "NORMAL": "\x0f",
  5. "BOLD": "\x02",
  6. "UNDERLINE": "\x1f",
  7. "REVERSE": "\x16",
  8. "WHITE": "\x0300",
  9. "BLACK": "\x0301",
  10. "DBLUE": "\x0302",
  11. "DGREEN": "\x0303",
  12. "RED": "\x0304",
  13. "BROWN": "\x0305",
  14. "PURPLE": "\x0306",
  15. "ORANGE": "\x0307",
  16. "YELLOW": "\x0308",
  17. "GREEN": "\x0309",
  18. "TEAL": "\x0310",
  19. "CYAN": "\x0311",
  20. "BLUE": "\x0312",
  21. "PINK": "\x0313",
  22. "DGRAY": "\x0314",
  23. "GRAY": "\x0315",
  24. }
  25. func replaceFormatting(msg string) string {
  26. for colour, code := range colourMap {
  27. msg = strings.Replace(msg, "%"+colour, code, -1)
  28. msg = strings.Replace(msg, "#"+colour, code, -1)
  29. }
  30. return msg
  31. }