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

color.sh 1.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env bash
  2. # Copyright © 2023 OpenIM. All rights reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #Define color variables
  16. #Feature
  17. COLOR_NORMAL='\033[0m';COLOR_BOLD='\033[1m';COLOR_DIM='\033[2m';COLOR_UNDER='\033[4m';
  18. COLOR_ITALIC='\033[3m';COLOR_NOITALIC='\033[23m';COLOR_BLINK='\033[5m';
  19. COLOR_REVERSE='\033[7m';COLOR_CONCEAL='\033[8m';COLOR_NOBOLD='\033[22m';
  20. COLOR_NOUNDER='\033[24m';COLOR_NOBLINK='\033[25m';
  21. #Front color
  22. COLOR_BLACK='\033[30m';COLOR_RED='\033[31m';COLOR_GREEN='\033[32m';COLOR_YELLOW='\033[33m';
  23. COLOR_BLUE='\033[34m';COLOR_MAGENTA='\033[35m';COLOR_CYAN='\033[36m';COLOR_WHITE='\033[37m';
  24. #background color
  25. COLOR_BBLACK='\033[40m';COLOR_BRED='\033[41m';
  26. COLOR_BGREEN='\033[42m';COLOR_BYELLOW='\033[43m';
  27. COLOR_BBLUE='\033[44m';COLOR_BMAGENTA='\033[45m';
  28. COLOR_BCYAN='\033[46m';COLOR_BWHITE='\033[47m';
  29. # Print colors you can use
  30. openim::color::print_color()
  31. {
  32. echo
  33. echo -e ${bmagenta}--back-color:${normal}
  34. echo "bblack; bgreen; bblue; bcyan; bred; byellow; bmagenta; bwhite"
  35. echo
  36. echo -e ${red}--font-color:${normal}
  37. echo "black; red; green; yellow; blue; magenta; cyan; white"
  38. echo
  39. echo -e ${bold}--font:${normal}
  40. echo "normal; italic; reverse; nounder; bold; noitalic; conceal; noblink;
  41. dim; blink; nobold; under"
  42. echo
  43. }