简体   繁体   English

更改按钮的颜色(如果已选中或将其悬停)

[英]Change color of a button if selected or hovered

Since I usually have a lot windows open in several desktops I built this script to help me switch to a certain app faster: Code Here 由于我平时有很多窗户几个桌面打开我建这个脚本来帮我切换到某个应用程序更快: 代码这里

For increased convenience I added a keyboard shortcut to execute the script. 为了增加便利性,我添加了键盘快捷方式来执行脚本。

While I don't think it's that bad for a newbie, in my desktop theme the button selection is very subtle: This is how it looks to me 虽然我认为这对于新手来说并不那么糟糕,但是在我的桌面主题中,按钮的选择非常微妙: 这就是我的外观

I'd like to have a lot more emphasis on the selected button by changing it's color. 我想通过更改按钮的颜色来更加强调所选按钮。 That would certainly help me switch between apps even faster. 这肯定会帮助我更快地在应用程序之间切换。 Thanks in advance for your help! 在此先感谢您的帮助!

You can customize it by using CSS . 您可以使用CSS对其进行自定义。

You could experiment in various ways. 您可以通过各种方式进行试验。 For example, I usually modify $HOME/.config/gtk-3.0/gtk.css and use gtk3-demo as sample application: 例如,我通常修改$HOME/.config/gtk-3.0/gtk.css并将gtk3-demo用作示例应用程序:

button:hover {
  background: #FF0;
}
button:active {
  color: #FFF;
  background: #F00;
}

在此处输入图片说明 Once you have it, you should restrict the styling to your own buttons by eg applying a custom class and using it in your CSS selectors: 拥有样式后,应将样式限制为自己的按钮,例如,应用自定义类并在CSS选择器中使用它:

button.mycustomclass:hover {
  ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM