Function fltk::app::foreground

source ·
pub fn foreground(r: u8, g: u8, b: u8)
Expand description

Set the foreground color

Examples found in repository?
examples/defaults.rs (line 10)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
fn main() {
    let (r, g, b) = utils::hex2rgb(0xfafdf3);

    let app = app::App::default();

    // global theming
    app::background(r, g, b); // background color. For input/output and text widgets, use app::background2
    app::foreground(20, 20, 20); // labels
    app::set_font(enums::Font::Courier);
    app::set_font_size(16);
    app::set_frame_type(enums::FrameType::RFlatBox);
    app::set_visible_focus(false);

    // regular widget code
    let mut win = window::Window::default().with_size(400, 300);
    let frame = frame::Frame::new(0, 0, 400, 200, "Defaults");
    let mut pack = group::Pack::default()
        .with_size(400, 50)
        .below_of(&frame, 50);
    pack.set_type(group::PackType::Horizontal);
    pack.set_spacing(80);
    let mut but1 = button::Button::default().with_label("Button1");
    but1.set_color(enums::Color::Yellow);
    but1.set_down_frame(enums::FrameType::RFlatBox);
    let mut but2 = button::Button::default().with_label("Button2");
    but2.set_color(enums::Color::Yellow);
    but2.set_down_frame(enums::FrameType::RFlatBox);
    pack.end();
    pack.auto_layout();

    win.end();
    win.show();

    app.run().unwrap();
}