pygfx.materials.BackgroundMaterial
- class pygfx.materials.BackgroundMaterial(*colors, **kwargs)
Bases:
Material
Solid/Gradient background color.
A background material that draws the background is a uniform color or in a gradient. The positional arguments are passed to
set_colors()
.- Parameters:
colors (list) – A list of 0, 1, 2, or 4 colors to use in the background. If zero, defaults to monochrome black. If one, the background will be monochrome using the given color. If two, the background will be a gradient from bottom to top using the given colors. If four, the background will be a gradient with each corner set to a different color. The value at a given position is then based on the relative distance of that position to each corner.
kwargs (Any) – Additional kwargs are passed to the base constructor (
pygfx.materials.Material
).
- set_colors(*colors)
Set the background colors. If one color is given, it will be used as a uniform color. If two colors are given, it will be used for the bottom and top. If four colors are given, it will be used for the four corners.
- property color_bottom_left
The color in the bottom left corner.
- property color_bottom_right
The color in the bottom right corner.
- property color_top_left
The color in the top left corner.
- property color_top_right
The color in the top right corner.