有什么方法可以根据颜色改变 Flex 4 主题吗?

发布于 2024-10-08 12:06:58 字数 179 浏览 5 评论 0原文

当我在 Flex 4 应用程序中选择默认主题 (Spark Default) 时,我只需更改 chromeColor 值,该主题将有效地为我更改主题的基色。

创建使用相同概念的新主题是否有任何特殊技巧?如果新主题是一个更加图形化的主题怎么办?

我想为我的应用程序提供许多基本主题,每个主题都有自己的一组颜色变体。

When I choose the default theme (Spark Default) in a Flex 4 app, I can merely change the chromeColor value and the theme will effectively change the base color of the theme for me.

Are there any special tricks to creating a new theme that uses this same concept? What if the new theme is a more graphical theme?

I'd like to offer a number of base themes for my application, each theme having it's own set of color variants.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你丑哭了我 2024-10-15 12:06:58

如果您只是想知道如何制作主题,您可以轻松地在 google 上搜索 Flex Create Theme,您应该会得到答案。老实说,通过使用几种不同的方法来获得“主题”,我不知道在大多数情况下制作基于 swc 的主题是必要的还是值得的。基本上,您的选择是创建多个在编译时更改的 CSS 文件,如果您希望它们在运行时更改,您可以将 CSS 编译成 SWF(在 flash builder 中右键单击 css 并编译为 swf),然后你可以在运行时加载它们
http://livedocs.adobe.com/flex/3 /html/help.html?content=styles_10.html
我个人做更多的组件开发和更少的样式设计,但从与我一起工作的人那里,他们的主要职业是样式设计,我听说过使用 SASS 的很棒的事情(谷歌它,基本上需要一些编程风格的 css 并为你制作一个 css 文件,但可以做各种很酷的东西)以保持一切井然有序且易于更新。您可能还想检查文件系统上的相对位置,看看他们做了什么来制作光环主题和内容:

\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.4\frameworks\themes
(SDK 版本会根据您下载或安装的内容而有所不同)

If you're just looking for how to make themes you can easily google Flex Create Theme and you should get your answer. Honestly from having used a few different methods of getting "themes" in place I don't know that going through with making a swc based theme is necessary or worthwhile most of the time. Basically you're options are create multiple CSS files that you change out at compile time, if you want them to change at run-time you can compile the CSS into a SWF (in flash builder right click the css and compile to swf) then you can load these at runtime
http://livedocs.adobe.com/flex/3/html/help.html?content=styles_10.html
I personally do more component development and less styling but from the people I work with whose primary occupation is styling I've heard great things about using SASS (google it, basically takes some programmatic style css and makes one css file for you but can do all sorts of cool stuff) to keep this all organized and easy to update. You might also want to check out this relative location on your file system to see what they've done to make the halo theme's and stuff:

\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.4\frameworks\themes
(SDK version will vary based on what you downloaded or installed)

祁梦 2024-10-15 12:06:58

诀窍是确保您的自定义皮肤是从 SparkSkin 扩展而不仅仅是 Skin 类。 SparkSkin 具有通过应用颜色变换将 chromeColor 应用于外观的所有元素(除了覆盖的“colorizeExclusions”getter 中返回的元素之外)的逻辑。查看默认的 ButtonSkin,了解如何创建利用 SparkSkin chromeColor 行为的组件外观的典型示例。

关于在皮肤中使用图形元素,只需确保它们是灰度的,并且 chromeColor 就会很好地应用。

希望有帮助。

The trick is to make sure your custom skins are extended from SparkSkin rather than just the Skin class. SparkSkin has logic that applies the chromeColor to all of the elements of the skin (except for those returned in your overridden "colorizeExclusions" getter) by applying a color transform. Take a look at the default ButtonSkin for a typical example of how to create a component skin that takes advantage of the SparkSkin chromeColor behavior.

Regarding using graphical elements in your skin, just make sure they are greyscale and the chromeColor will get applied just fine.

Hope that helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文