When I created Live Titles Version 1, I had a real issue with creating a colour selector. There’s no built in tool to select a colour in the OS and while I had looked briefly at a couple of third party tools, I just ran out of time and created a simple colour list.
For version 2 I knew I wanted something better and this is what I’ve come up with:
It’s composed of five primary items:
- The Windows Phone Theme colours
- Some common colours you’re likely to use
- A custom colour selector
- A transparency selector
- The buttons
The entire colour selector is in a popup class and sits over the main panorama page in Live Titles.
The first two areas of common colours are just a grid with rectangles of each colour in them. A simple OnClick event determines which colour you selected and then sets the custom colour selector to that value.
The custom colour selector is provided by the Coding4Fun Windows Phone Toolkit and very easy to work with.
The transparency selector is a standard Windows Phone Slider and the buttons at the bottom are similarly just standard buttons.
The entire popup is only created once for the application and then reused to allow the user to select the font, background and border colours in Live Titles.
There are a few items that I had to work around to get everything working:
- There seems to be a bug in the Coding4Fun library, it sometimes fails to set the colour you want, but a second attempt to set the colour seems to work.
- You have to trap the Windows Phone back button, otherwise when the popup is displayed, the back button will exit Live Titles, probably not what the user expects
.
- Live Titles uses the Application Bar at the bottom of the screen, you have to hide it when the popup is displayed otherwise the user might go somewhere unexpected.
- The last “colour” in the custom colour list is a transparent value, hence why it has a grey outline around it.
Other than that, it was relatively straightforward to get the colour selector working and just deployed.