Python output with color font in detail

Source: Internet
Author: User

Tag: image does not use the start IMG default BSP Color tle

Writing format:
opening Section :\033[display mode, foreground color, background colour m + End part:\033[0m

Note: The first part of the three parameters: Display mode, foreground color, background color is an optional parameter, you can write only one of them, in addition, because the three parameters of the different meaning of the values are unique and no duplication, so the three parameters of the writing sequence is not fixed requirements, the system can be recognized; It is recommended that you write in the default format specification. for the end part, can also be omitted, but in order to write the specification, it is suggested \033[*** beginning, \033[0m end.
--------------------------------------------------------------------------------------Font Color     |       Background Color     |      Color Description-------------------------------------------        |       |       Black        |       |       Red        |       |       Green        |       |       Yellow Color        |       |       Blue        |       |       Purplish Red        |       |       Cyan Blue Panax Notoginseng        |       |       White--------------------------------------------------------------------------Display Method     |      Effect-------------------------------0           |     Terminal default settings 1           |     Highlight 4           |     Use underscore 5           |     Flashing 7           |     Anti-white display 8           |     Not visible-------------------------------

Numeric representation of the parameter meaning:

display mode:0 (default), 1 (highlighted), 22 (not bold), 4 (underscore), 24 (non-underlined), 5 (blinking), 25 (non-blinking), 7 (inverted), 27 (non-inverting)
Foreground color:30 (Black), 31Red, 32Green, 33Yellow, 34Blue, 35 (magenta) , 36 (cyan) , 37 (white)
background color :  40 (black) (red) (green) (yellow) (blue) (Magenta) (cyan) , 47 (white)
Common opening formats :
\033[0m default font normal display, not highlighted
\033[32;0m Red font Normal display
\033[1;32;40m display: Highlight font foreground color: Green background color: Black
\033[0;31;46m display mode: Normal font foreground color: Red background color: Cyan For example: 1,
Print (' \033[1;35;0m font color, but no background color \033[0m ')  # has a highlight or print (' \033[1;35m font colored, but no background color \033[0m ') print (' \033[1;45m font does not change color, Background Color \033[0m ') # has a  highlighted print (' \033[1;35;46m font colored, and has a background color \033[0m ')  # has a highlighted print (' \033[0;35;46m font colored, and has a background color \033[0m ')  # No highlighting

Results:

2,

Print (' \033[0;36m Moon, ') print (' Doubt is ground frost. Print (' Jutou, ') print (' Look down at home. \033[0m ')

Results:

Python output with color font in detail

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.