zoukankan      html  css  js  c++  java
  • 011#ANSI颜色系列

    #!/bin/bash
    # ANSI color ---
    
    initializeANSI()
    {
      esc="e"    # 同'33'
    
      # 前景色:
      blackf="${esc}[30m";
      redf="${esc}[31m";
      greenf="${esc}[32m";
      yellowf="${esc}[33m";
      bluef="${esc}[34m";
      purplef="${esc}[35m";
      cyanf="${esc}[36m";
      whitef="${esc}[37m";
    
      # 背景色:
      blackb="${esc}[40m";
      redb="${esc}[41m";
      greenb="${esc}[42m";
      yellowb="${esc}[43m";
      blueb="${esc}[44m";
      purpleb="${esc}[45m";
      cyanb="${esc}[46m";                                                                                               
      whiteb="${esc}[47m";
    
      # 粗体、斜体、下划线以及样式切换:
    
      boldon="${esc}[1m";
      boldoff="${esc}[22m";
      italicson="${esc}[3m";
      italicsoff="${esc}[23m";
      ulon="${esc}[4m";
      uloff="${esc}[24m";
      invon="${esc}[7m"; # 反色,前景色与背景色互换
      invoff="${esc}[27m";
      reset="${esc}[0m"
    }
    
    initializeANSI
    echo -e "
    ${yellowf}This is a phrase in yellow${redb} and red background.${reset}
    ${boldon}This is bold ${ulon}this is underline${reset}
    ${italicson}This is italics${italicsoff} and ${reset}reset to nornal
    ${yellowf}${redb}Warning 1${yellowb}${redf}Warning 2${reset}
    ${invon}${yellowf}${redb}Warning 1${invoff}${yellowb}${redf}Warning 2${reset}
    "
    
    *** 你必须十分努力,才能看起来毫不费力 ***
  • 相关阅读:
    nginx增加lua支持
    使用nginx+lua实现web项目的灰度发布
    amoeba学习
    信号有关的内容
    Linux系统的进程相关内容
    等待类型
    孤立用户故障排除
    恢复数据库
    执行计划之Insert,update,delete
    临时表和表变量
  • 原文地址:https://www.cnblogs.com/bigtree2pingping/p/13028253.html
Copyright © 2011-2022 走看看