Hub app Title Inverting colors


  • Does anyone have the code to make the title  color of a hub app to adapt to the bockground color.

    For Example:

    A black title bar move from a bright image into a dark background, it'll invert its color to increase readability of the title bar.

    Saturday, January 31, 2015 4:13 PM

All replies

  • There isn't an automatic way to do this. You'll need to get the background colour and then calculate the title colour from that. Depending on how you set the background colour this may be fairly easy or it may be very difficult (solid colours: easy. images & other non-solids: hard).

    In general the best way is to choose images that are consistently dark or light in the title area.

    Sunday, February 01, 2015 5:11 AM
  • How am I supposed to do that....
    Friday, February 06, 2015 5:09 AM
  • It depends on what you're trying to do. You'll need to explain what exactly you are doing if you need help with it.
    Friday, February 06, 2015 11:46 PM
  • Like in the Bing News app , the title changes color when it transitions into the white bit of it
    Saturday, February 07, 2015 4:58 AM
  • What information do you have?

    You need to know if the area under the text is dark or light: this is easy if you can control the information to know that you have a static background colour or can pick images which have a known dark or light band.

    If you need to calculate it from an arbitrary image then it can be rather difficult. You'll need to get the pixels in the area of interest and decide if they are dark or light. If it's solid then it is easy to calculate the brightness. If it's not solid then you'll need to come up with an algorithm to decide how to interpolate the different pixel images.

    Once you know if the area is dark or light then the rest is easy: set either the light or dark brush for the text.

    The only trick is to decide when to check, which will be application specific but likely tied to the text moving over the background (or the background moving under the text).


    Thursday, February 12, 2015 1:28 AM
  • but code wise, what is the concept? Cause I'm new to Making Win Store apps.
    Saturday, February 14, 2015 1:52 AM