Skip to main content

border

Function border 

Source
pub fn border(
    view: &ViewHandle,
    r: f64,
    g: f64,
    b: f64,
    width: f64,
) -> ViewHandle
Expand description

Apply .border(_:width:). Apply .border(_:width:) with colour components.

Opaque. There is no alpha parameter and the colour is built at 1.0, so a translucent border is not expressible here — use border_value with a colour that carries its own alpha. The chainable View::border does.

Examples found in repository?
examples/ios_app.rs (line 290)
276fn effects() -> views::ViewHandle {
277    let tile = |c: Color| views::frame(&views::color(c.r, c.g, c.b, c.a), 48.0, 40.0);
278    views::hstack_spacing(
279        &[
280            views::blur(&tile(Color::new(0.95, 0.4, 0.3, 1.0)), 4.0),
281            views::shadow(
282                &tile(Color::new(0.3, 0.7, 1.0, 1.0)),
283                Color::new(0.0, 0.0, 0.0, 0.8),
284                8.0,
285                0.0,
286                4.0,
287            ),
288            views::opacity(&tile(Color::new(0.5, 0.9, 0.5, 1.0)), 0.35),
289            views::corner_radius(&tile(Color::new(0.9, 0.7, 0.2, 1.0)), 12.0),
290            views::border(&tile(Color::new(0.0, 0.0, 0.0, 0.0)), 1.0, 1.0, 1.0, 2.0),
291        ],
292        10.0,
293    )
294}