How to set CSS rule for Label using gtkmm API

Can I set this CSS rule for the label widget, without connecting external file

label
{
    caret-color: transparent;
}

some setter like set_css_value for example?
just want to make this small rule directly from C++ file

You can only load the CSS fragment into a CssProvider and assign it to the display (in GTK4) or to the screen (in GTK3). You can embed the CSS in a string and use gtk_css_provider_load_from_string(); or you can use a GResource, and keep the CSS in a separate file that gets compiled into your binary.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.