There are many parameters and properties you can use to control the way your text looks. This page will list them and show examples of each. All of these settings may be used on both BitmapLabel and Label.

Font

The font parameter is used to set the typeface for your text. The default value is terminalio.FONT, which is the built-in font for the system. Different builds of CircuitPython can have different built-in fonts, though many of them have the same one. Blinka_Displayio has a built-in font as well. You can load custom font files from pcf and bdf font files using the adafruit_circuitpython_bitmap_font library.

Scale

The scale parameter is inherited from Group. It can be used to make the label bigger. The default value is 1. Set it to a larger integer to make the text bigger by that scale factor.

Color

color is an optional parameter and property that controls the color of your text. The value should be a hex color value, and the default is 0xFFFFFF or white.

Background Color

The optional parameter and property background_color will cause a background box to be drawn containing your text. The default is None, which causes no background to be drawn. Set it to a color hex value to enable, i.e. 0xFF00FF.

Padding

There are 4 parameters that can be used to adding padding to the insides of your label: padding_top, padding_bottom, padding_left, and padding_right. You can use any single one, or any combination of them.

Background Tight

The background_tight parameter specifies that you want the background box to be drawn as small or tight as possible. When this is set to True, the padding values will be ignored. Also, if there are no glyphs used with descender sections, then the background won't include space for them. The default value is False, which will include space for the descender even if your text does not have any of them.

Line Spacing

The optional line_spacing parameter and matching property are used to specify how much space should appear between different lines of text. You can use "\n" in your text to make a new line. The default value is 1.25, which looks pretty good with the built-in font. You can go smaller to pack the lines closer, or bigger to add some extra blank room between lines.

This guide was first published on Mar 09, 2021. It was last updated on Mar 09, 2021.

This page (Label Appearance) was last updated on Feb 24, 2021.

Text editor powered by tinymce.