Skip to content

struct

Style

pub struct Style {
    pub fill: Option<Color>,
    pub stroke: Option<Color>,
    pub line_width: f32,
    pub fill_to: Option<Color>,
    pub radial: bool,
    pub glow: f32,
    pub opacity: f32,
}

Fill/stroke styling for a shape.

Fields

fill

pub fill: Option<Color>

Fill colour, if filled.

stroke

pub stroke: Option<Color>

Outline colour, if outlined.

line_width

pub line_width: f32

Outline width.

fill_to

pub fill_to: Option<Color>

Second gradient stop: the fill blends from fill to this across the shape (top → bottom, or centre → edge when radial).

radial

pub radial: bool

Whether the fill_to gradient is radial.

glow

pub glow: f32

Glow radius in pixels (a coloured canvas shadow).

opacity

pub opacity: f32

0 (invisible) to 1 (opaque).

Methods

fill

pub fn fill(color: Color) -> Style

A fill of color, with no stroke.

stroke

pub fn stroke(color: Color, width: f32) -> Style

A stroke of color, width wide, with no fill.

Trait implementations