📜 ⬆️ ⬇️

Creating your own usplash theme

As promised in the previous topic , I describe in detail how to create your own usplash theme. First we need: GIMP and some skills in working in it, as well as the following packages:
gcc, libbogl-dev, libusplash-dev

Any Usplash theme consists of at least three components: the background image, the body of the progress bar, the background of the progress bar. With the background image everything is clear, this is the basis on which everything else will be. The body of the progress bar is a picture that, as it loads, replaces the picture-background of the progress bar.

So, first make yourself a background. I chose the one that stands for me as the background on the desktop. We will determine the size of our splash. You need to choose the largest possible - in my case 1024x768. Accordingly, we bring the size of the background image to this size.
Now the most important thing: you need to create and save the color palette of your image. All other images must have the same palette.
')
I specifically mark - Windows-> Panels-> Color Swatches, then already in the window: Menu-> Palette Menu-> Import Palette. Next, select our image . Screenshot

The palette can contain up to 256 colors.
Save the image with the name usplash_1024_768.png. We create the same images for other resolutions - (I did only 800x600); We also save in png format and in the same palette. Call usplash_800_600.png.

Now is the time to create a progress bar. We create two drawings (I did 216x8 px) - we bring them to the already created palette ( screenshot ), save one - throbber_fore.png, the second - throbber_back.png (Front and back respectively).
Next, a little programming.

Directly sources of my topic can be found here.

I’ll dwell on what is really important.

Beginning of the topic structure description:
struct usplash_theme usplash_theme_1024_768 = {
.version = THEME_VERSION,
.next = NULL,
.ratio = USPLASH_4_3,


.next - pointer to the following structure. To make a topic for other permissions, we copy the Structures, specify the name of the following structure in the .next pointers. The pointer in the last structure must be NULL
.ratio = USPLASH_4_3 - this line sets the aspect ratio of the topic.

/* Background and font */
.pixmap = &pixmap_usplash_1024_768,

/* Palette indexes */
.background = 0x0,
.progressbar_background = 0x0,
.progressbar_foreground = 0x200,
.text_background = 0x17,
.text_foreground = 0x32,
.text_success = 0x171,
.text_failure = 0x156,


Everything should be clear here: on the left - the element, on the right - what color it will be. The color numbers correspond to their numbers in your palette (you can see it in the same GIMP).

/* Progress bar position and size in pixels */
.progressbar_x = 404, /* 1024/2 - 216/2 */
.progressbar_y = 524,
.progressbar_width = 216,
.progressbar_height = 8,


Position and size of the progress bar. The position is individual for each of the permissions. The sizes should correspond to the sizes of the throbber_fore and throbber_back pictures.

/* Text box position and size in pixels */
.text_x = 322,
.text_y = 525,
.text_width = 380,
.text_height = 100,


Description of the position of the textual output zone (system messages are displayed here if they appear during loading).

Actually everything is more. Then the whole thing needs to be collected (there is a makefile in the archive), and the resulting usplash.so file will be our topic. Next - either use the StartUp manager or

# update-alternatives --config usplash.so

That's all! Use :)

Source: https://habr.com/ru/post/82661/


All Articles