zoukankan      html  css  js  c++  java
  • printf "33[31;42mhello world33[0m "

    C语言设置输出的字体前景色和背景色

    颜色如下:

    none = "33[0m"
    black = "33[0;30m"
    dark_gray = "33[1;30m"
    blue = "33[0;34m"
    light_blue = "33[1;34m"
    green = "33[0;32m"
    light_green -= "33[1;32m"
    cyan = "33[0;36m"
    light_cyan = "33[1;36m"
    red = "33[0;31m"
    light_red = "33[1;31m"
    purple = "33[0;35m"
    light_purple = "33[1;35m"
    brown = "33[0;33m"
    yellow = "33[1;33m"
    light_gray = "33[0;37m"
    white = "33[1;37m"

    字背景颜色范围: 40--49 字颜色: 30--39
    40: 黑 30: 黑
    41:红 31: 红
    42:绿 32: 绿
    43:黄 33: 黄
    44:蓝 34: 蓝
    45:紫 35: 紫
    46:深绿 36: 深绿
    47:白色 37: 白色

    输出特效格式控制:

    33[0m 关闭所有属性
    33[1m 设置高亮度
    3[4m 下划线
    33[5m 闪烁
    33[7m 反显
    33[8m 消隐
    33[30m -- 33[37m 设置前景色
    33[40m -- 33[47m 设置背景色

    光标位置等的格式控制:

    33[nA 光标上移n行
    3[nB 光标下移n行
    33[nC 光标右移n行
    33[nD 光标左移n行
    33[y;xH设置光标位置
    33[2J 清屏
    33[K 清除从光标到行尾的内容
    33[s 保存光标位置
    33[u 恢复光标位置
    33[?25l 隐藏光标
    33[?25h 显示光标

    例子(.sh文件中实现):

    printf "33[0m My father 33[0;30m was a 33[1;30m self-taught 33[0;34m mandolin player. 33[1;34m He was 33[0;32m one of 33[1;32m the best 3 3[0;36m string instrument 33[1;36m players in 33[0;31m our town. 33[1; 31m He could 33[0;35m not read music, 33[1;35m but if 33[0;33m he hear d 33[1;33m a tune a 33[0;37m few times, 33[1;37m he could 33[30m pl ay it. 33[47m When he 33[40m was younger, 033[47m he was a member of a s mall country music band. "

    效果:

  • 相关阅读:
    团队作业(三):确定分工
    团队作业(二):项目选题
    团队冲刺DAY3
    团队冲刺DAY4
    团队冲刺DAY6
    团队冲刺DAY1
    团队冲刺DAY5
    团队冲刺DAY7
    团队作业(四):描述设计
    【自学Spring Boot】什么是Spring Boot
  • 原文地址:https://www.cnblogs.com/BASE64/p/13399152.html
Copyright © 2011-2022 走看看