apply_style
styles
- styles.apply_style(target, style)
- Parameters:
target – widget object
style – Style to apply
apply_style could be used in certain libraries that provide access to the color setter.
Quickstart: Importing and using apply_style
Here is one war of importing
apply_style
function so you can use it as the namecolors
and the color setDarkAmber
:from Adafruit_CircuitPython_Styles import apply_style from Adafruit_CircuitPython_Styles.styles import DarkAmber
For a created Label object in
adafruit_display_text
text_area = bitmap_label.Label(terminalio.FONT, text="Hello", x=10, y=10)
you can apply the style library using:
apply_style(text_area, DarkAmber)
The function will verify the object and apply the changes according to the features available
- styles.color_fade(start_color: int, end_color: int, fraction: float)
Linear extrapolation of a color between two RGB colors (tuple or 24-bit integer). :param start_color: starting color :param end_color: ending color :param fraction: Floating point number ranging from 0 to 1 indicating what fraction of interpolation between start_color and end_color.
- styles.color_to_tuple(value)
Converts a color from a 24-bit integer to a tuple. :param value: RGB LED desired value - can be a RGB tuple or a 24-bit integer.
GetStyle
Display Text style definitions. Based on the PySimpleGui styles used under the LGPL3+ license.
- class styles.styles.GetStyle(color)
GetStyle allow any library to use the colorset available.
Quickstart: Importing and using GetStyle
Here is one war of importing
GetStyle
class so you can use it as the namecolors
and the color setBluePurple
:from adafruit_styles.style import GetStyle, BluePurple
Now you can create a color set using:
colors = GetStyle(BluePurple)
all the four color attributes will be available in colors. This could be easily accessed via:
colors.text_color
Currently there are four attributes
background_color
,text_color
,line_color
andborder