colors.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. Copyright 2020 Docker Compose CLI authors
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package progress
  14. import (
  15. "github.com/morikuni/aec"
  16. )
  17. type colorFunc func(string) string
  18. var (
  19. nocolor colorFunc = func(s string) string {
  20. return s
  21. }
  22. DoneColor colorFunc = aec.BlueF.Apply
  23. TimerColor colorFunc = aec.BlueF.Apply
  24. CountColor colorFunc = aec.YellowF.Apply
  25. WarningColor colorFunc = aec.YellowF.With(aec.Bold).Apply
  26. SuccessColor colorFunc = aec.GreenF.Apply
  27. ErrorColor colorFunc = aec.RedF.With(aec.Bold).Apply
  28. PrefixColor colorFunc = aec.CyanF.Apply
  29. )
  30. func NoColor() {
  31. DoneColor = nocolor
  32. TimerColor = nocolor
  33. CountColor = nocolor
  34. WarningColor = nocolor
  35. SuccessColor = nocolor
  36. ErrorColor = nocolor
  37. PrefixColor = nocolor
  38. }