A collection of scripts and configurations for Bash (and others)
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

124 lines
1.4KB

  1. _CC() {
  2. local f="39"
  3. local b="49"
  4. local s="0"
  5. if [ "$1" ]; then
  6. f="${1}"
  7. fi
  8. if [ "$2" ]; then
  9. b="${2}"
  10. fi
  11. if [ "$3" ]; then
  12. s="${3}"
  13. fi
  14. echo "\[\e[${s};${b};${f}m\]"
  15. }
  16. _CFG() {
  17. local f="39"
  18. if [ "$1" ]; then
  19. f="${1}"
  20. fi
  21. echo "\[\e[${f}m\]"
  22. }
  23. _CBG2FG() {
  24. case "$1" in
  25. $BG_DEFAULT)
  26. echo $DEFAULT
  27. ;;
  28. $BG_BLACK)
  29. echo $BLACK
  30. ;;
  31. $BG_RED)
  32. echo $RED
  33. ;;
  34. $BG_GREEN)
  35. echo $GREEN
  36. ;;
  37. $BG_YELLOW)
  38. echo $YELLOW
  39. ;;
  40. $BG_BLUE)
  41. echo $BLUE
  42. ;;
  43. $BG_PURPLE)
  44. echo $PURPLE
  45. ;;
  46. $BG_CYAN)
  47. echo $CYAN
  48. ;;
  49. $BG_GREY)
  50. echo $GREY
  51. ;;
  52. $BG_DGREY)
  53. echo $DGREY
  54. ;;
  55. $BG_LRED)
  56. echo $LRED
  57. ;;
  58. $BG_LGREEN)
  59. echo $LGREEN
  60. ;;
  61. $BG_LYELLOW)
  62. echo $LYELLOW
  63. ;;
  64. $BG_LBLUE)
  65. echo $LBLUE
  66. ;;
  67. $BG_LPURPLE)
  68. echo $LPURPLE
  69. ;;
  70. $BG_LCYAN)
  71. echo $LCYAN
  72. ;;
  73. $BG_WHITE)
  74. echo $WHITE
  75. ;;
  76. *)
  77. echo $1
  78. ;;
  79. esac
  80. }
  81. DEFAULT='39'
  82. BLACK='30'
  83. RED='31'
  84. GREEN='32'
  85. YELLOW='33'
  86. BLUE='34'
  87. PURPLE='35'
  88. CYAN='36'
  89. GREY='37'
  90. DGREY='90'
  91. LRED='91'
  92. LGREEN='92'
  93. LYELLOW='93'
  94. LBLUE='94'
  95. LPURPLE='95'
  96. LCYAN='96'
  97. WHITE='97'
  98. BG_DEFAULT='49'
  99. BG_BLACK='40'
  100. BG_RED='41'
  101. BG_GREEN='42'
  102. BG_YELLOW='43'
  103. BG_BLUE='44'
  104. BG_PURPLE='45'
  105. BG_CYAN='46'
  106. BG_GREY='47'
  107. BG_DGREY='100'
  108. BG_LRED='101'
  109. BG_LGREEN='102'
  110. BG_LYELLOW='103'
  111. BG_LBLUE='104'
  112. BG_LPURPLE='105'
  113. BG_LCYAN='106'
  114. BG_WHITE='107'
  115. #NORMAL="\[\033[0m\]"
  116. NORMAL="\[\e[0m\]"
  117. CLEAR=$(_CFG $DEFAULT)