What system color should be used to draw text on accent background? - windows-phone-7

I need to put text in a panel with accent (PhoneAccentBrush) background. PhoneForegroundBrush for text looks good in dark theme, but doesn't play well with light theme. It looks like the text always should be white regardless the theme.
What color should be used in such cases?

White is probably your best bet. (It's used for the text on live tiles to aid easier readability regardless of the tile color-which is often the accent color.)
You could also consider black.
The size of the panel and the weight & size of the text will impact appropriateness of color choice too.

Related

UIImage - highlight single color only

I need to convert an image to greyscale except for a single color. For example, if there is some red in the image (like a red bus), this will remain in color, but the rest of the image will remain in black & white.
I think I should be able to do a rudimentary job of this by going over each pixel individually, such as here: http://brandontreb.com/image-manipulation-retrieving-and-updating-pixel-values-for-a-uiimage . I am assuming I would just leave certain pixels alone if their red component was above a certain amount, and green/blue was below a certain amount. Otherwise, set the pixel to grayscale. Is this a good approach?
I'm more interested in whether or not it is possible to do to the live camera input, such as with a Core Image filter, or using GPUImage, but I haven't been able to find any suitable filters. Any suggestions?
Update:
This seems to be possible using GPUImage with a GPUImageLookupFilter, as per: https://stackoverflow.com/a/19340583/334982
I've created a lookup.png file in Photoshop, by dropping the Saturation for all colours except red to 0. This works ok, but it doesn't seem to grey out all colours. For example, my skin still looks fairly skin coloured, and my brown table is still fairly brown.

MAC Terminal: Anyone know how to give text a default background / highlight color?

I wish to have a transparent terminal.
In order the view the letters without increasing the font size, I would like to have a contrast by coloring the text's background.
Does anyone know of a way to do this? Perhaps installing a special font?
Your best bet would be to use bright colored text. I was just experimenting and it seems like a good, bright red stands out on most backgrounds. You can also experiment with the blur effect your terminal has. A higher blur will allow for more background contrast. I did not see a way to color the text's background color itself though.

Automatically choose appropriate gray color for a given background color

I have a table in which the cells may contain normal and grayed-out text. The color for normal text is chosen dynamically according to this post in order to take account that the table's background color is theme-dependent. Now I'm wondering if there's any good way to determine an appropriate "gray" color based on the table's background, so that:
the "gray" is "really" gray when the background color is white or black
the grayed-out text is readable with all possible background colors
if possible, the grayed-out text should be distinguishable from normal text, and ideally look "paler", in the same way that gray is paler than black
Note: Other styles, such as strike-out, are not appropriate in my case, since the gray color is used to convey the idea of a table cell being "less important" than others, rather than being obsolete/unavailable/etc.
Well, your linked question selects only one of two text colors: it will be either black or white.
Did you try to just use a "dark gray" when the text color is black, and a light gray when the text color is white?

How does one reproduce the inset text style when drawing text with Mac OS X Cocoa?

I'm talking about the groove style of the text on focussed title bars, or safari's bookmarks bar for example. Is there an easy way to reproduce this style when using:
[string drawAtPoint:... withAttributes:...];
If you want it to look perfect, you'll need to draw the text twice.
As you can see when zooming in on labels below toolbar items in any app, or for instance the bookmarks bar in Safari (Control+scroll up, control+option+\ to toggle smoothing of the zoomed in image), the text is rendered with sub-pixel anti-aliasing, at least when "Font smoothing style:" in the "Appearance" system preferences is set to medium, which it will be by default on Macs with a built-in or external Apple flat-panel display.
NSShadow can not be used with sub-pixel anti-aliasing, so if you simply set an NSShadowAttributeName in the attributes dictionary you're drawing your string with, you will notice sub-pixel anti-aliasing is MIA when you zoom in on your rendered text.  Due to the way NSShadow is designed, no matter what color you set your NSShadow instance to —even if it is opaque— it will always be drawn with an alpha channel, making sub-pixel antialiasing impossible.
The solution is really very simple:
Draw your text once with a white color with some transparancy,
Then draw it once more on top of that, a pixel higher in a shade of grey of your liking with no transparancy.
Your 'shadow' will draw without sub-pixel antialiasing, but the actual text on top op of it will draw with it, giving you the exact same effect as standard Cocoa toolbar button item labels, or items in the Safari bookmarks bar.
EDIT: It seems that Safari's bookmarks bar items draw their 'shadows' with sub-pixel accuracy as well, so the way they did it is probably by choosing an opaque shade of gray for the white 'shadow' text as well; drawback of that approach: you are tying your drawing code to only work well on a particular background color, e.g. if your elements will be used on a blue background, you'll want to set that color to a light shade of blue, to appear like it's semi-transparent white.
Draw it with an un-shadow below it. Use a shadow with color white, opacity 50% or so, blur 0, offset 1 pt down.
A simple way to do this is to simply draw the text twice. The first time, you draw it 1 pt lower, in white, at 50% opacity. The second time, you draw it in the desired position, in the desired color, at the desired (probably 100%) opacity.

How to make icon with pink background transparent?

I'm using Visual Studio icon library (VS2008ImageLibrary), there are some BMP files with a pink background. How can I make the pink background become transparent? What software can I use to do this? Any free one?
Thanks
I used IrfanView's batch conversion tool. It's still some work, because you have to click the pink area on every single icon instead of just specifying pink as transparent color, but it worked. It would be easy to write a simple conversion tool using GDI+ though, which I considered as well.
Note that even though you can use them then as transparent images, many of them unfortunately still have ugly edges when you render them on a dark background or use them as overlay. If you just want very few of them, consider tweaking them individually if you think you'll not always have a bright background.
You can try it online provided you can transform your bmp into a gif first.
Or you can grab PAINT.Net (freeware), and apply a transparent background by following this video instructions.
You can do it by using ImageMagick convert:
convert input.png -transparent magenta output.png
By the way, it is not pink, its magenta colour.
While I don't know the modern .NET answer to your question, it's worth noting the historical reason for these bitmaps with magenta backgrounds:
Back in the Win32-only days, there were some Common Controls (like the Toolbar, and ListView) that took these bitmaps and a colour to be treated as transparent, and then rendered that colour as transparent. I imagine that, behind the scenes, they used functions like TransparentBtl.
I know it's something related to Form.TransparencyKey
but I donno what is exactly that pink, you have to know the exact RGB / system or Web color.
if you know please share us

Resources