我正在尝试做一些非常基本的 UI 东西,我需要将特定颜色设置为按钮的背景。我正在使用 Gtk2/Ruby,这里有一些示例,我在 Windows 10 上看到了这个问题。
#!/usr/bin/env ruby
require 'gtk2'
# Creates the main window.
@window = Gtk::Window.new
# You should always remember to connect the delete_event signal
# to the main window. This is very important for proper intuitive
# behavior.
@window.signal_connect("delete_event") do
Gtk::main_quit
false
end
@window.border_width = 10
# Create a button
@button = Gtk::Button.new("Test")
# Set the colors to test
@button.modify_bg(Gtk::STATE_NORMAL, Gdk::Color.parse("#049678"))
@button.modify_bg(Gtk::STATE_PRELIGHT, Gdk::Color.parse("blue"))
@button.modify_bg(Gtk::STATE_ACTIVE, Gdk::Color.parse("yellow"))
@window.add(@button)
# Display all widgets.
@window.show_all
# As usual, we finish by entering the main loop, with Gtk.main.
Gtk.main
这就是结果。查看按钮边缘出现的橙色色调。我认为使用标准绿色没有这个问题。
知道如何摆脱边框上的橙色吗?