如何在 jQuery UI 主题中获取主色/次要颜色
有没有一种方法可以引用 jQuery 主题中使用的颜色,而无需为我可能选择使用的每个主题创建简单的样式?
示例:我有一些如下文本
,
我希望根据当天的主题更改颜色。 我希望使用主题(例如 ui-lightness)中的原色,该主题是“#1c94c4”,如在 ui-lightness 中的 ui-state-default 等多种样式中定义的.css
问题是,如果我执行以下
我会得到所有其他样式效果,例如边框和背景颜色不适合我的应用程序 我想做的是
,
它会自动更改仅颜色取决于主题。
附言。 进行预构建预处理步骤来解析主题并生成自定义 CSS 样式将是我最不喜欢的选择!
Is there a way to reference the colours used in the jQuery themes without creating a simple style for each theme that I may choose to use?
Example: I have some text as follows
<div>Hello</div>
which I'd like to be change colour in line with my theme of the day. I wish to use the primary colour from a theme (say ui-lightness) which is "#1c94c4" as defined in several of the styles such as ui-state-default in ui-lightness.css
The problem is that if I do the following
<div class='ui-state-default'>Hello</div>
I get all the other style effects, like borders and background colour, which are not right for my application
What I'd like to do is something like
<div class='ui-primary-color'>Hello</div>
which would automatically change only the colour dependent on the theme.
PS. Doing a pre-build pre-processing step to parse the themes and generate a customised css style would be my least favourable option here!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
给了我颜色:“rgb(255, 255, 255)”
gave me color: "rgb(255, 255, 255)"
是的,您可以将任何 UI CSS 直接添加到任何 html 元素,在单独的类中生成其他样式来处理特定需求,甚至重写一个类以消除边框样式等。 搜索 jQuery“ThemeRoller-ready”站点。
我还建议您查看 jQuery 论坛。
jQuery 主题 页面也值得一读。
Yes, you can can add any of the UI CSS directly to any html element, produce additional styles in separate classes to handle particular needs or even override a class to get rid of, say, a border style. Search for jQuery 'ThemeRoller-ready' sites.
I also suggest you to take a look at the jQuery forum.
jQuery theming page also worth reading.