This is the 16th day of my participation in the August More Text Challenge. For details, see:August is more challenging

WangScaler: an author who works with his heart.

Statement: talent and learning shallow, if there is a mistake, kindly correct.

A list,

Many programmers add their own startup ICONS to their projects to make them look good. When a project like our SpringBoot starts, the console prints the following ICONS.

Or the Easter eggs we see on bilibili’s console.

It feels so beautiful, so how can we add such cool ICONS to our own projects? Let’s learn.

Two, make icon file

If you’re a god, you can design your own. What I choose here is a few ready-made artistic words, found five urls for you, enough to use it. If you have a better one, feel free to comment down and let’s all learn.

  • 1、 patorjk
  • 2, the network – science
  • 3, kalvinbg
  • 4, degraeve
  • 5, bootschool

1, custom art word.

According to the text you want to generate art word, here is the third url as an example. If you feel that the recommended fonts don’t give you the effect you want, you can choose from all the fonts you like. (You can find the corresponding Font type by previewing all Font types)

2, the picture generated string painting

The fourth url can be generated according to the picture string painting, the effect looks ok, quick to turn your favorite picture into a string picture.

3, other

You can get some nice string images directly at the last url.

////////////////////////////////////////////////////////////////////
// _ooOoo_ //
// o8888888o //
". "88 //
/ / / / (| ^_^ |)
// O\ = /O //
/ / consists of / ` - '____ / /
/ /. '\ | | / / `. / /
: / / / \ | | | | | | / / / / /
/ / / _ | | | | | - : - | | | | | - / / /
/ / | | \ \ / / / | | / /
/ / | _ | '- /' | | / /
// \.-__ '-' ___/-. // /
// ___ '...' /--..
. / /. "" '< ` ____ < | > _ / ___." "' > '. / /
/ / | | : ` - `.; ` \ _ / `; . ` / - ` : | | / /
// \ '-. _ __\ /__ _/.-' // //
/ / = = = = = = = = ` - ____ ` - _____ / ___. - ` _____. - '= = = = = = = = / /
/ / ` = - = '/ /
/ / ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / /
// Buddha bless never crash never BUG //
////////////////////////////////////////////////////////////////////
Copy the code

This is seen in many projects, programmers like to use, such as open source project Zoe is this. Under the blessing of Buddha, never bug, hahaha.

/ = = = -_ - - - ~ ~ ~ ~ ~ ~ ~ ~ ~ -- -- -- -- -- - ____ | = = = - ~ ___ _, -'- = = \ ` / / ~ \ ~ ~ ~ ~ ` - ___. - ~ ~... - = = | | | \ _ - ~ ` __ - ~ ~ ~ - / - = = \ | | ` \,'_ - ~ /'| \ / / / /.| \ /'/ / /'There comes / / | `. __ / - ~ ~ ~ \ _ _'/ /'                     
/-'~ ~ ~ ~ ~ ~ -- -- -- -- | ~ - / ~ ()/'_ -- - ` _ | / _);) , __ - ~ ~'~~--_/ _-~/- / \ '-~ \ {__--_/} / \_>-)<__\ /' (_/ _-~ | |__>--<__| | |0 0 _/) )-~ | |__>--<__| | / /~ ,_/ / /__>---<__/ | o o _// /-~_>---<__-~ / (^(~ /~_>---<__- _ - ~ / | __ > - < __ / _ - ~, / / ('(| __ > - < __ | /. - _ ((')) | __ > - < __ | | / '_ _ ~ \ ` -)))) (| __ > - < __ | | /'/ ~ ` \, /,'/ / ((> - < (\ \ / '/ / | |,((((,)) ~-__>--<_~-_ ~--____-- ~' _/'/        /'` `), ~ /) / | ~ _ ~ > - < __ / __ __ - ~ _ /. _ - ~ / / ())) ` ~ ~ -'_ / _ / / ~ ~ ~ ~ ~ ~ ~ __ - ~;'(') /,) (~ ~ ~ ~ ~ ~ ~ ~ ~ ~' ') '((/'   '`Copy the code

This dragon is also good, there are many other graphics, go ahead and choose your favorite and get it into your project.

3. SpringBoot modify icon

1. Copy the above string and put it in the banner. TXT file.

2. Put the banner. TXT file in the main/resource folder.

Springboot prints ICONS by default, so you’re almost done. Springboot also provides some parameters to print the project information and, optionally, to modify the font color.

3. Print version information and modify color

  • Enumeration class AnsiColor: there are many colors, go to the official website to see what there are. ${ansicolor. BLUE} in the banner.

  • Project information

    options
    ${application.version} The version number in the manifest.mf file
    ${application.formatted-version} The version number above is preceded by a V and followed by parentheses
    ${spring-boot.version} Version number of SpringBoot
    ${spring-boot.formatted-version} Version number of SpringBoot

You can choose to print the version information. Springboot can also specify images to be printed directly.

4. Modify it as a picture

Add the following content to the configuration file:

spring:
    banner:
        image:
            location: banner.jpg
Copy the code

Print ICONS for Python projects

1. Copy the string and put it in the banner

2. We do it in the simplest way possible. Read the file, then print it

import logging
def startout() :
    file_object = open("./banner.txt")
    try:
        all_the_text = file_object.read()
    finally:
        file_object.close()
    logging.info("\n"+all_the_text)
Copy the code

3. Execute when starting the project

if __name__ == '__main__':
    startout()
Copy the code

Five, the summary

After all, there is no practical significance, but still can be as beautiful as beauty, if you have any problems in the operation, you can directly comment down. Or if there is something wrong with what I wrote, you can correct it. Thank you for wasting your time watching my ramble.

Here we are. Give us a thumbs-up before we go!

Pay attention to WangScaler, wish you promotion, pay rise, no bucket!