简体   繁体   English

拾色器选择的彩色显示

[英]Color Picker Selected Color Display

I am working on an app which allows me to select a color. 我正在开发一个允许我选择颜色的应用程序。 Currently, I have a simple button which says "Pick a Color" which launches a new modal with colors. 目前,我有一个简单的按钮,上面写着“ Pick a Color”,它会启动一个新的颜色模态。 Once, the user selects the color the "Pick a Color" text is replaced with the color name (requirement) and the button background is filled with the selected color. 一次,用户选择一种颜色,“选择颜色”文本将替换为颜色名称(要求),并且按钮背景将填充所选的颜色。 The problem arises when the selected color is same as the text color of the button. 当所选颜色与按钮的文本颜色相同时,就会出现问题。 In that scenario the user will not be able to see the selected color text since it gets mixed with the background color. 在那种情况下,用户将看不到所选的颜色文本,因为它与背景颜色混合了。

How to deal with this issue? 该如何处理?

This sounds like a design issue more than anything else. 这听起来像是一个设计问题,比什么都重要。 If you have a UI guy/gal on the project, I would defer to their judgment in this case. 如果您在该项目上有一个UI家伙/ gal,那么在这种情况下,我将服从他们的判断。

In Spend Stack I had a similar issue since the users can change their color scheme throughout the entire app, I eventually just made everything work with a white font color. Spend Stack中,我遇到了一个类似的问题,因为用户可以在整个应用程序中更改其配色方案,最终我最终使所有内容都使用白色字体。 In your instance, I am going to assume your font color is white as well. 在您的情况下,我将假设您的字体颜色也是白色。 In that case, you could just add a condition to change the text color when white is selected easily by using one of the factory methods on UIColor : 在这种情况下,您可以添加一个条件,以通过使用UIColor的工厂方法之一轻松选择白色时更改文本颜色:

lbl.textColor = [UIColor redColor]; //or whatever color you want

I would also just fire off a message regardless when a new background color is selected for scalability reasons. 无论出于可伸缩性原因,无论何时选择新的背景色,我都会触发一条消息。

A great example to look at is Chameleon which deals with the exact same issue you mentioned 变色龙就是一个很好的例子,它可以处理与您提到的完全相同的问题 在此处输入图片说明

Best of luck! 祝你好运!

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

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