You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public final func readableColor() -> DynamicColor {
return isLightColor() ? UIColor.blackColor() : UIColor.whiteColor()
}
and or another that use the inverse / complement at your discretion
it's not much related to the colors elaboration it's more an utility that can be useful
The text was updated successfully, but these errors were encountered:
I don't know if it would be really helpful because the text can be different than just black or white. I think it is better to let the user choose which color he needs rather than enforce him to use only black or white.
I thought about this issue and I think we should create a contrasted method that return either the white or the black color to contrast against the receiver.
Yes maybe somenting
constrastingColor(forBackgroundColor: UIColor, foregroungColor: UIColor) -> UIColor
that act someway like
background color lightRed
foreground color lightRed
-> returns darkRed
background color lightRed
foreground color lightPink
-> returns darkPink
checking backgroundColor.isDark() //ex. false
//if foregroundColor == nil returns black // or white for dark backgrounds
return foregroundColor.darken(amount: x) // x to be calculated according to WCAG 2.0
You can add the
and or another that use the inverse / complement at your discretion
it's not much related to the colors elaboration it's more an utility that can be useful
The text was updated successfully, but these errors were encountered: