使用 CSS 使禁用的 Flex Spark 按钮更具可读性
我有一个 Flex Spark Button
,我使用它将背景更改为深色。
s|Button {
color: #66ffff;
chromeColor: #333333;
}
问题是,当按钮被禁用时,它很难阅读(文本颜色和背景颜色非常接近) )。我尝试将禁用的颜色设置为更浅的颜色,
s|Button:disabled {
color: #ffffff;
}
但是禁用的文本的颜色不是#ffffff
。它是文本颜色和背景的某种组合。有没有办法禁用此行为(即指定确切的禁用状态的文本颜色)?
I have a Flex Spark Button
that I've changed the background to a dark color using
s|Button {
color: #66ffff;
chromeColor: #333333;
}
The problem is that when the button is disabled, it's very hard to read (the text color and background color are very close). I've tried setting the disabled color to something lighter
s|Button:disabled {
color: #ffffff;
}
But the disabled text's color is not #ffffff
. It's some combination of the text color and the background. Is there someway to disable this behavior (ie, specify the exact disabled state's text color)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在与按钮的默认皮肤作斗争。如果您要基于
ButtonSkin
创建新的按钮皮肤,您会看到整个皮肤的 Alpha 已设置:alpha.disabled="0.5"
。将值设置为 1.0 可以解决您的问题,但仅仅为了修改这个单个值而定义整个皮肤似乎有些过分了。
希望有一种更优雅的方式。我尝试在禁用样式中设置
alpha: 1.0;
,但它不起作用。我唯一能做的就是创建一个新的按钮样式,设置 alpha.disabled="1.0" 并告诉按钮使用稍微修改过的样式。You are battling with the default skin of the button. If you were to create a new button skin based on
ButtonSkin
, you would see that the alpha for the entire skin is set:alpha.disabled="0.5"
.Setting the value to 1.0 solves your problem, but it seems overkill to define this entire skin just to modify this single value.
Hopefully, there is a more elegant way. I tried setting
alpha: 1.0;
in the disabled style, but it doesn't take. The only thing I have been able to do is create a new button style, setalpha.disabled="1.0"
and telling the button to use that slightly modified style.您可以创建 2 个 .css 文件,一个用于标准视图,一个用于“禁用”视图,并设置您自己的按钮属性。编写一个函数来更改要使用的 .css 文件。
You can create 2 .css files, one for the standard view and one for the "disabled" view and set your own button properties. Write a function which changes the .css file to use.