Color Yad box and buttons

541 views
Skip to first unread message

Rasat

unread,
Feb 16, 2023, 1:59:03 PM2/16/23
to yad-common
On the MX Linux forum, there is one nice Yad script for another Exit menu. Click here

I want to use my own colors for the frame (#ffffff (white) and buttons (#4f94ce (blue). Could not find a color solution in Yad, but instead trying to use a simple gtk3 theme, copied from this page. Click here

I made one new theme folder
$HOME/.themes/Exit-menu/gtk-3.0/gtk.css

Added GTK_THEME="Exit-menu" in the Yad script.

GTK_THEME="Exit-menu" \
yad --center  --borders=4 --class="yad-fblogout" --window-title="Exit actions" --title="Exit actions" --keep-icon-size --buttons-layout=center  --skip-taskbar --sticky --single-click $nodeco $timer $tbar \
--button="... Lock ... \
--button=".... Logout ... \
--button=".... Suspend .... \
--button="...... Reboot .... \
--button="...... Shutdown

In gtk.css this script....
/* The background of the entire window */
/*
box {
    background-color: #ffffff;
} */

button {
   color: white;
   background-image: image(rgb(79,148,206));
}

The background color is always black instead of white. This is the result... click screenshot

With the box script, the buttons are white with a black frame.
box {
    background-color: #ffffff;
}

Any solution,
Markku

Victor Ananjevsky

unread,
Feb 16, 2023, 2:28:11 PM2/16/23
to yad-c...@googlegroups.com
hi

is that what are you looking for?

#! /bin/bash

trap "rm -f gtk.css" EXIT
cat <<EOF > gtk.css
#yad-form-button { color: black; background-color: #0000f0; }
#yad-dialog-window { background-color: #ffffff; }
EOF

yad --css=gtk.css --no-buttons \
--form --columns=5 \
--field "Lock:btn" "" \
--field "Logout:btn" "" \
--field "Suspend:btn" "" \
--field "Reboot:btn" "" \
--field "Shutdown:btn" ""


Thu, 16 Feb 2023 10:59:03 -0800 (PST)
Rasat <da...@rasatpc.net> написав:

> On the MX Linux forum, there is one nice Yad script for another Exit menu. Click
> here <https://forum.mxlinux.org/viewtopic.php?t=73992>
>
> I want to use my own colors for the frame (#ffffff (white) and buttons
> (#4f94ce (blue). Could not find a color solution in Yad, but instead trying
> to use a simple gtk3 theme, copied from this page. Click here
> <https://stackoverflow.com/questions/55348868/how-do-i-get-yad-for-gtk3-to-customize-button-font-background-and-foreground-co>
>
> I made one new theme folder
> $HOME/.themes/Exit-menu/gtk-3.0/gtk.css
>
> Added GTK_THEME="Exit-menu" in the Yad script.
>
> GTK_THEME="Exit-menu" \
> yad --center --borders=4 --class="yad-fblogout" --window-title="Exit
> actions" --title="Exit actions" --keep-icon-size --buttons-layout=center
> --skip-taskbar --sticky --single-click $nodeco $timer $tbar \
> --button="... Lock ... \
> --button=".... Logout ... \
> --button=".... Suspend .... \
> --button="...... Reboot .... \
> --button="...... Shutdown
>
> In gtk.css this script....
> /* The background of the entire window */
> /*
> box {
> background-color: #ffffff;
> } */
>
> button {
> color: white;
> background-image: image(rgb(79,148,206));
> }
>
> The background color is always black instead of white. This is the
> result... click screenshot
> <https://rasatpc.net/screenshot/myExt/Exit-Action/black-blue-exit-menu.png>
>
> With the box script, the buttons are white with a black frame.
> box {
> background-color: #ffffff;
> }
>
> Any solution,
> Markku
>



--
wbr
Victor Ananjevsky <anan...@gmail.com>

Rasat

unread,
Feb 17, 2023, 3:56:45 AM2/17/23
to yad-common
Thanks for the sample script. It works but doesn't change the color when the color codes are changed. This is how it looks... click screenshot.

Rasat

unread,
Feb 17, 2023, 7:08:54 AM2/17/23
to yad-common
Thanks, got it to work with the GTK_THEME="Exit-menu". I did a test by adding the generated gtk.css to the Exit-menu theme folder with a slight edit. 

button { color: black; background-color: #4f94ce; }
#yad-dialog-window { background-color: #ffffff; }

NOTE: It must be written as mentioned above.... no space between # and yad-dialog-window or other changes.

Reply all
Reply to author
Forward
0 new messages