Open layer 3 label - openlayers-3

I have seen this link: http://openlayers.org/en/v3.4.0/examples/vector-labels.html
But how can I have a label with a background rectangle of a chosen color, to improve the readability (such as white text over a black rectangle) ?

Related

How can I make a text box background color NOT transparent in Gimp?

I often need to add text to an image. To do this, I use the Text Tool. When I click on the image, I can start filling in the text. However, the box that the text is in always shows up as transparent. There are times where this is good, but many times I want black text on a white box. How can I set the color of the box the text is inside?
You can just bucket fill the layer (no selection) after putting the bucket tool in Behind mode. But this makes the text layer no longer a text layer (text and font information is lost).
So a better solution is to add a layer under the text later and bucket-fill, with two options:
Make a layer the right size (when you create the layer it takes by default the side of the active layer) and bucket-fill the whole layer
Make an image-size layer, make a rectangle selection and bucket-fill the selection
Note that bucket-filling the text layer (or a layer which is the exact same size) usually won't look good because the boundaries of the layer come from the font geometry (so you can stack/abut layers) and there is a lot more space on top and bottom than on the sides.

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.

UILabel text color dependant on location over a UIImage

I want my UILabel's text color to be dependent on the UIImage that is beneath it. I think the solution involves getting the average color of my UIImage but I don't know what tools are available for me in swift to get that information. Also, my label is in the top left corner. I don't want the average color of the whole image. I want the average color of the area around my label.

how to change the Label/TextField text color Based on background image color in iOS Objective-C?

I'm working on UIImageView with Labels and TextFields.
In my scenario, how can I change the label text color based on background image?
For Example: My Background image white, in that scenario the label text color is black or red except white.
Please help me.
Thanks in Advance.
Just engineering of answers found online:
Calculate average color for your background image:
how to find average color of image
Calculate an inverted color for the found color:
inverting a UIColor
Set label.textColor to a result color

Resources