ActionBar text color via Codename One - codenameone

I can set Android's ActionBar background color easily via this code on colors.xml
<resources>
<color name="colorPrimary">#ffffc003</color>
<color name="colorPrimaryDark">#ffffffff</color>
<color name="colorAccent">#ff009486</color>
</resources>
I figured I could set the text to black adding this part:
<color name="textColorPrimary">#ff000000</color>
But it has no effect, so the background is white and the text is also white.
BTW it would be nice to allow programatically change these values, so different forms could style their own action bars.
[EDIT] The first image has android.statusbar_hidden=true. The second, use colors.txt with colorPrimaryDark as white. And the third is the result I would like to have: a status bar with white background and black foreground.

This will only impact the color of the status bar on top but it won't have any impact if you set the status bar to transparent.
It won't impact the action bar itself which is now drawn 100% by Codename One. I would suggest setting the status bar to transparent which will be more consistent with the way iOS handles this: how can color of status bar be changed as per different forms in codenameone?

Related

Main Window title bar color change in wpf

I want the color of title bar to be changed from green to red in wpf.
How can I do it??
Like this -
[
Title bar is not a client area and hence is not available for editing as such.
You can though set WindowStyle="None" and then add a custom border around your window.
Make sure you add Close Maximize and Minimize buttons to it.
And if you are using .net 4.5 WindowChrome can be useful as well

Canvas background color not as white as I need

I am setting the background color of my Canvas as 'white'. However when I compare my canvas with a vendor application, their canvas is 'whiter', which is the color I want for my canvas too. I have looked at all the color choices available for canvas background color but nothing makes my canvas any whiter than it is. Any suggestions would be appreciated.
Simple solution:
Use one of the browser plugins to get the actual "white" color of their app.
One example of a color-picker is Chrome plus the ColorZilla extension:
https://chrome.google.com/webstore/detail/colorzilla/bhlhnicpbhignbdhedgjhgdocnmhomnp

wpf menuitem child item. How to set the color behind the drop-down

I have a menu that I've been asked to style so that the items have rounded corners... basically so that they look like buttons.
I want to change the black background behind the sub-menu so that it's transparent. White would be OK too.
This black isn't the border of the child item's buttons as I can set that to yellow and I see a slight yellow border but still see the black background.
I changed all the instances of black to purple as a test and still got this black background. So I can't tell where it's coming from.
Thanks.
Success! In order for the Popup's Border's background to be transparent you need to set AllowsTransparency="True" on the Popup element.
You'll need to restyle the menu. Here is the example of how it's done by default. Look at the Popup in <ControlTemplate x:Key="{x:Static MenuItem.TopLevelHeaderTemplateKey}" ..., you'll need to replace it with your implementation. Perhaps you just need to remove <Border Name="SubmenuBorder"..., putting the ScrollViewer directly as a child of Popup.

WP7 How to change the ellipses color in the application bar?

I have an app bar with custom colors to match the page color of our application. I have managed to get the images and app bar itself to the colors I want, but not the ellipses at the top right. I have set the background color to white and the foreground color to blue. In expression blend, it looks like the ellipses are set to blue, but when I run the app, they are white (same color as the app bar background) and basically invisible. Is there a way to change the color of the ellipses?
Not sure why it does not work for you but following code in sample application worked for me:
<shell:ApplicationBar IsVisible="True"
IsMenuEnabled="True"
ForegroundColor="Orange">
I created a new PivotApplication project for Windows Phone. In a new page, I added ForegroundColor property to application bar and it worked.

How can I change the color of an image in silverlight/WP7 (Color Mask)?

I have a toggle button with a png that has a transparent background and a black foreground. If the button is selected then I want the black color of the image to change to a color chosen by the user. Is there a way to do this in Silverlight and/or wp7?
So for example:
<ToggleButton>
<Image Source="MyImage.png" />
</ToggleButton>
MyImage.png has a transparent background and a black foreground. The user's preferred color is red. When the button is toggled on I want the black foreground of the image to turn red.
I would try OpacityMask approach. Basicaly it should look something like this:
<Rectangle Fill="Red">
<Rectangle.OpacityMask>
<ImageBrush ImageSource="MyImage.png"/>
</Rectangle.OpacityMask>
</Rectangle>
by changing rectangle's fill property you would get different colored image.
How much control does the user have over the colour?
If they are picking from a limited set (e.g. red, green, blue, black, brown) then the simplest thing to do would be to bind the image source to a variable which holds the name of the image and then change which name is held in that variable.
If they can pick any colour then you need to do some image processing to change the black pixels of a reference image to the selected colour, write that to isolated storage and then bind the image source to that new file.
Another alternative is to draw the button in XAML and then you can have direct control over the foreground colour. This MSDN page describes the basics of drawing. You can use the same commands to define the image on a button, as described on this page from Scott Gu's blog:
(this is the image of the code from the blog).
If you bind the colour to a variable then the user can change the colour of the image. It does rely on you being able to draw the image in XAML though.

Resources