Inverted colours in Kivy ToggleButtons - kivy

Have a set of ToggleButtons where the general foreground colour is green and the general background colour is black. Then I use
background_down: 'btn_prs_grn.png'
on_state: self.color = [0,0,0,1] if self.state == 'down' else [0,1,0,1]
To make (I thought) the active button black-on-green, but what I get is more like slightly-darker-green-on-normal-green.
I assume this is because the button (label) colours are blended/tinted/whatever-it's-called together.
Edit: here is a photo of the buttons.
Left button normal, right button down. It is actually possible to make out the text "White" on the right button, in a slightly darker shade of green than the normal one.
What is the easiest way to achieve black-on-green? I understand I can draw on the canvas myself but is there a simpler method?

Output - ToggleButton
Button
In kv file, set background_normal: ''
background_color
background_color
Background color, in the format (r, g, b, a).
This acts as a multiplier to the texture colour. The default
texture is grey, so just setting the background color will give a
darker result. To set a plain color, set the background_normal to
''.
The background_color is a ListProperty and defaults to [1, 1, 1, 1].
background_normal
background_normal
Background image of the button used for the default graphical
representation when the button is not pressed.
background_normal is a StringProperty and defaults to
‘atlas://data/images/defaulttheme/button’.

Related

What is the color code for iOS system labels in both light and dark mode?

Human Interface Guidelines, "Color" section talks about the using system color is preferred. There are color codes for all system colors however for the foreground content text color there only APIs provided.
So what exactly is the color code for labels in both light and dark mode? Our designers need these colors for their mockup.
https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/color/
The color code fetched from the Playground does not seem right. The hex codes are all the same.
The RGB values of secondary, tertiary, and quaternary label colour are in fact the same. They only differ in the alpha value, which you might have forgotten about :)
From what I observed:
Label colour has 100% alpha
Secondary label colour has 60% alpha
Tertiary label colour has 30% alpha
Quaternary label colour has 18% alpha
Here's another way to find the hex value of a system colour. Go to the asset catalog of an Xcode project. Add a colour set:
Then, select "Any Appearance" or "Dark Appearance" depending on which one you want ("Any Apperance" means "not dark"). You can even check the "High Contrast" box to have more options for how your dynamic colour will look depending on the situation.
Then select your desired colour from the "Content" dropdown (see freehand circle).
Finally, you can click on "Show Color Panel" to see the hex:

Skip a particular color in smart invert mode of accessibility

Is there any way to skip a particular color in whole app when device is in smart invert mode of accessibility?
I don't want the blue color in my app to be inverted. I have am image which have black and blue color text in it. I want the black color text to be inverted but want to skip blue color.
Any help would be appreciated.
P.S -I am familiar with accessibilityIgnoresInvertColors. But this property can be applied on uiview or object but i need to skip a color.
do it inside the appcolor constant file :- you can check UIAccessibilityIsInvertColorsEnabled() if its true then return clear color else reurn the blue color.

Change text color of page which is in form of UIImage

I am making an app for book reading, the content of the book is in form of images and I want to change the text colour of the page (image). I have tried many of filters like CIFalseColor, CIColorInvert etc. background colour of the page is white and text colour is black. How can I change the only text colour to green etc. and how can I change the background colour of the image which is white now.
You should be able to achieve this using CIColorMatrix.
To transform black text on white to black text on green you can apply a CIColorMatrix to "turn off" the red and blue channels, so you'll be left with just green. Use [0 0 0 0] as the input vectors for R and B but keep inputGVector as [0 1 0 0]. White will become green (0,1,0) and black will still be black (0,0,0).
To transform black text on white to green text on white you can apply a CIColorMatrix to force the green channel to 1, keeping the others intact. Use all the default input vectors except inputGVector which you set to [1 1 1 0]. White will still be white (1,1,1) and black will now be green (0,1,0).

white text on white background image in swift

I've image and label over it. Images are of multiple color and I would like to add text label of white color. Is there anyway I can make the label text standout even if background image is white color?
I tried lowering alpha value for the background image, it gives little effect but label text not standing out clearly unless alpha value for background image is too low.
Set up your label field with a shadow on it.

UIView background color set is not what appears

I created a UIView with a set background color. Lets say RGB value 185, 45, 42. For some reason, when I take a screenshot of this view, it is not that color. It is a little bit darker. Is there a reason why UIView would do this?
The UIView background color is set in interface builder like this:
When I run it on the simulator and take a screenshot and use the eye drop tool to determine the color, the numbers that show up are a little bit darker than what I entered. Same with a button.
I have other screens with the same red color and the screenshot I take of those, the red actually comes out correctly. I've been trying to determine what the difference is between those screens, but so far have not seen any. So I was just wondering if anyone would have any knowledge of anything that "could" case such a color change.
A common mistake when setting a color numerically in Interface Builder is to neglect the color space:
Different color spaces will give different colors (visually) for the same RGB values.
When you set RGB color, you should notice that all the three color values range from 0 to 1, so give them a value greater than 1 would never work. Try this:
RGB(185 / 255.0, 45 / 255.0, 42 / 255.0)

Resources