yad 5.0 (GTK+ 3.24.13) background color?

885 views
Skip to first unread message

dave

unread,
Jan 10, 2020, 1:17:11 PM1/10/20
to yad-common
I can't find it in the manual, but is there a way yet to set the dialog background color?


thanks 
- Dave

Robert Cooper

unread,
Aug 26, 2022, 12:48:48 PM8/26/22
to yad-common
Hi Dave,

Did you find a way to set dialog background color ?

dave

unread,
Aug 29, 2022, 10:28:09 PM8/29/22
to yad-common
No, sorry I haven't :(

Robert Cooper

unread,
Aug 30, 2022, 11:46:57 AM8/30/22
to yad-common

Ok, Thanks for letting me know. I'll keep trying different configuration and post if I fine a workaround to have custom backgrounds for each button.

Robert Cooper

unread,
Aug 30, 2022, 11:55:07 AM8/30/22
to yad-common
I just had a thought, what about no borders at all ? is it possible to compile Yad with borders disabled ? I'll try it and see.

 export CFLAGS="$CFLAGS -DBORDERS=0"
./configure --enable-standalone
make
make install
 
(above code is from Victor responding here to a question: https://groups.google.com/g/yad-common/c/owxYKtxgWPI/m/4DqOi8nbBgAJ )

dave

unread,
Aug 30, 2022, 3:56:38 PM8/30/22
to yad-common
I'd be interested in knowing how that worked out.  If you get it working can you post a screenshot?

Robert Cooper

unread,
Aug 30, 2022, 9:21:38 PM8/30/22
to yad-common
I was able to create a ---form --field....BTN with a transparent background that emulates "no borders".  

Concerning Dialog background color:
          gtk 2.x only change is override all window backgrounds which is not very useful.
   
          gtk 3.x  I found gtk override window background color, only available 3.0, depredicated in 3.16, information at gtk site here:  https://docs.gtk.org/gtk3/method.Widget.override_background_color.html

gtk site recommends use of css styling to control widget backgrounds.  I don't know how to call a gtk widget from yad.

GtkWidgetoverride_background_color

Sets the background color to use for a widget.

All other style values are left untouched. See gtk_widget_override_color().


Available since:
3.0
Deprecated since:
3.16

This function is not useful in the context of CSS-based rendering. If you wish to change the way a widget renders its background you should use a custom CSS style, through an application-specific GtkStyleProvider and a CSS style class. You can also override the default drawing of a widget through the GtkWidget::draw signal, and use Cairo to draw a specific color, regardless of the CSS style.


Robert Cooper

unread,
Aug 30, 2022, 9:26:30 PM8/30/22
to yad-common
Another thread that may be of use on gtk background, css control. 

On Tuesday, August 30, 2022 at 12:56:38 PM UTC-7 dave wrote:

Robert Cooper

unread,
Aug 31, 2022, 12:31:14 AM8/31/22
to yad-common
This works ! I was able to change a yad dialog bg_color:#000000 & fg_color:#ffffff  
I now have a yad Dialog window diplaying a Black Background and white text.

yad has option to use a different theme file for a given dialog

yad --gtkrc="/usr/share/themes/my-modified-theme"

See Previous Group Post about "--gtkrc"  option: https://groups.google.com/g/yad-common/c/XAYErPwlzOs/m/fd-mUeL9AQAJ

--------------
copy current theme gtkrc at /usr/share/themes/theme-name directory to /usr/share/themes/your-new-named-theme-directory
Modify your new gtkrc file as needed.
Link it in a yad dialog window with yad --gtk option.

I have not tried to change button background color and button border color but, surely it can be done as well.



On Tuesday, August 30, 2022 at 12:56:38 PM UTC-7 dave wrote:

dave

unread,
Aug 31, 2022, 2:00:44 PM8/31/22
to yad-common
Trying that... I have theme folders, not rc files though.  Inside the folder (/usr/share/themes/mytheme/gtk-3.0/) are 3 files: gtk-dark.css, gtk.css, and gtk.gresource.  Which one should I be focussing on, do you know?

Robert Cooper

unread,
Aug 31, 2022, 3:11:27 PM8/31/22
to yad-common
I apologize for not clarifying that my testing is with GTK-2.0 exclusively at this time. 

GTK-3.x Theme css are not clear on what elements are effected by a theme's given css.  Its very confusing. 

There may be a solution though, take a look as this program (in Ubuntu respos) that will adjust theme colors for both GTK2 & GTK3, have not tested it though, 
The source is also available for download. I just booted my Ubuntu setup and will test "GTK Themes Preference" program and if it works easy enough, I'll compile it on my Q4OS & Sparky Linux versions too. 


Maybe do before / after file compare to find what changes are made in *.css files for GTK-3.0

I'm thinking that if you have a file coparator program where you can use before & after compares that would tell  you which element to change in GTK-3.0 css files.

Robert Cooper

unread,
Aug 31, 2022, 3:25:01 PM8/31/22
to yad-common
gtk-prefences-config is not available in current Ubuntu repos. It only works on  gtk-dev 3.4.2+, So I need to build a special setup with gtk3 so I can  test this program.

Maybe next week before I can have time for this adventure. I'll post what I learn, soon.

Bobby

dave

unread,
Aug 31, 2022, 3:29:38 PM8/31/22
to yad-common
cool, thanks!!

Robert Cooper

unread,
Aug 31, 2022, 4:08:02 PM8/31/22
to yad-common
Here is another option I am testing right now,. on a Debian 10 Buster system "Q4OS 3 Centaurus", Plasma Desktop (KDE) and thes debian packages Package kde-config-gtk-style && Package kde-config-gtk-style-preview


(back soon)

Robert Cooper

unread,
Aug 31, 2022, 4:50:19 PM8/31/22
to yad-common
Dang, this is a blast when things go write  (short lived happiness though) , you'll see in this linked image a Yad text-info window with text file include shown in the foreground,  See this image: http://yadgui.com/files/images/darktheme-q4os-kde.png 

The image only shows yad with dark background theme, However, this gave me an idea....

If you can find a dark GTK-3 theme that will give you the result you want or changes to the button backgrounds, etc., it would be a mater of comparing the two theme css' files to decipher what elements need to be changed.  t

Its got to be easier than this !!!!!!...... I know in GTK-2.0 it is much easier.  Use a custom gtkrc file with correct settings to get results,  GTK-3.0 with its css files appears to be a night-mare.

The system tI tested with is a Q4OS 3 Centaurus with plasma KDE Desktop installed. It is a live iso usb stick.  I also installed the 2 previously mentioned KDE packages but, they were already installed in this version of Q4OS.

I'll now switch Q4OS back to the light theme and use  yad --gtkrc option to see if I can use the dark theme just for a specific yad window. 

I hope this helps.

Bobby

Robert Cooper

unread,
Aug 31, 2022, 8:31:15 PM8/31/22
to yad-common
My build, Ubuntu 20.04    +GTK-3.2.4 / +KDE Plasma  / +kde-config-gtk-style & preview. 
 
      Here is my video showing some options kde-config. https://rumble.com/v1i5wqt-accessing-kde-config-gtk-style-and-preview-functions-installed-gtk-3.html

To Install on Ubuntu + KDE Plasma Desktop:

   Install GTK3.x --> sudo apt-get install libgtk-3-dev

   Install KDE Plasma on Ubuntu --> sudo apt-get install kde-plasma-desktop (OK, gdm3, OK, Reboot, Click on login, Settings Icon = Plasma)

   Install kde-config --> sudo apt-get install kde-config-gtk-sytle

  Install kde-config-preview --> sudo apt-get install kde-config-gtk-style-preview

------------------------------------

Another good kde-config video on youtube: https://www.youtube.com/watch?v=nRtyFtpf5yU

NOW, I can look at the css files in gtk3 to see what I need to know to make Yad GTK3 tweaks.
Reply all
Reply to author
Forward
0 new messages