0

I would like to change (on Linux/Debian/Sid/x86-64, GTK 3.22) the default background color (for untagged text) in a GtkTextView (or else its GtkTextBuffer).

This and that answers don't help (are obsolete).

In my bismon program (see this question for details) I tried, on some global extern GtkWidget *commandview_BM; initialized with:

commandview_BM = gtk_text_view_new_with_buffer (commandbuf_BM);
gtk_widget_set_name (commandview_BM, "commandview");

To use

#commandview {
    background-color: seashell;
    font-size: 18px;
    font-family: Inconsolata;
}

in my bismon.css file, but that does not work. Replacing #commandview by #commandview.text or #commandview.view don't change anything.

I would also be happy if some default tag existed in GtkTextBuffer-s, but this does not seem to be the case.

I have (at least) two textviews in the same window (one for commands; another for logging) and I would like them to have different background colors.

1 Answer 1

3

The working syntax in CSS file is with a space to separate the name from the class, so in my case:

#commandview text {
    background-color: seashell;
    font-size: 19px;
    font-family: Inconsolata;
}
Sign up to request clarification or add additional context in comments.

1 Comment

check Gtk Inspector. It's a nice tool and permits runtime CSS debugging among other things.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.