WP7 - Assessing theme color - windows-phone-7

For a WP7 App I want to use an additional color to contrast whatever the the current theme color is.
I decided to make the contrast color 'Red' unless the theme color was already 'Red' in which case I would male the contract Color ' Blue'
But the following code does not work as it does not detect the theme color as 'Red' even though it has been set that way and is certainly showing that way in the app.
private void AssessContrastColor()
{
System.Diagnostics.Debug.WriteLine("In assess color");
SolidColorBrush themeBrush = App.Current.Resources["PhoneAccentBrush"] as SolidColorBrush;
Color themeColor = themeBrush.Color;
SolidColorBrush contrastBrush = new SolidColorBrush();
// contrastBrush.Color = ControlPaint.Light(themeColor);
if (themeColor == Colors.Red)
{
contrastBrush.Color = Colors.Blue;
}
else contrastBrush.Color = Colors.Red;
_ContrastThemeBrush = contrastBrush;
}
The code seems pretty straightforward, but, when looking at this through debugger, the Phone accent color when I get it (when its Red) is not #FFFF0000 but something a little different.
Just as an aside to this, was looking to create the contrast color as one that was a bit lighter than the theme color, looked around and it seemed like it could be quote a bit of code, but then stumbled across the 'ControlPaint.Light call' which seemed ideal, but doesnt seem to be an option uder WP7? Hence commented out above.
Any advice appreciated. Thanks

This would be because the Accent colour isn't Red, but something close to it, to be precise #E51400
You can find a list of all the colours and how to use them here. And for future proofing the answer, a list of all the colours:
Blue #1BA1E2
Brown #A05000
Green #339933
Lime #8CBF26
Magenta #FF0097
Orange #F09609
Pink #E671B8
Purple #A200FF
Red #E51400
Viridian #00ABA9
But I would strongly recommend against changing the contrast colours. You're likely to make content less readable.

If you determine a custom colour based on the accent colour, it will likely break when used by the eleventh (vendor specific) colour. From the documentation:
Your application should be aware of this extra color and not make assumptions on just the 10 system-wide colors. For example, do not have code that checks for the standard 10 accent colors and then performs a specific operation; an eleventh color may break the operation

Related

Change color of expanded dgml node

In a dgml file, an expanded Node can have the Background color set which changes the background of the border and title bar. The Foreground color sets the color of the title text.
The body currently seems to be filled with a color that depends on the current color theme selected in the Visual Studio options dialog. This means some people end up with white backgrounds and some black. This causes issues, especially when trying to export as xps to print the diagram. A massive block of black ink is a waste of ink!
How can the color of the body of the expanded Node be specified?
No it cannot. It was a "UI design" decision. Filling the entire group background with color conflicted too much with the VS color scheme. For example, a dark theme editor showing tons of White looks ugly, and a light themed VS showing tons of dark colors also looks ugly...sorry.

Background color and console text color

I am using PowerShell and I have run into the issue that I cannot distinguish certain colored text from the background. I have tried to go with default PowerShell blue, black, white, grey... There is a problem with all colors. For example with white - vagrant is colored yellow. If I choose black or blue then I cannot see Laravel's artisan which is blue (inside vagrant box). On grey I think I didn't read yellow and the bring green from logging into vagrant.
It's not as if I can change the background on the go as it often retains the background color as text background color. Also switching constantly would be annoying. I have tried Googling said issue but I have not come across anything that corresponds to the issue I am having. Surely there is a solution for this somehow?
I am posting this as a separate post since the only response I got was missing a few details to make it complete.
If you ever run across this error, then you indeed go to Properties > Colors and not only change the background color but change all the other colors presets to match. They are not there to offer you some presets to choose from, which I mistakenly believed - they are actual color definitions used by the console. When you are done, make sure that the selected colors for background, text etc have not shifted.
For example: PowerShell is dark blue. As such you cannot use colors that are similar and the bright regular blue I will change to light blue, which stands out easily. And voilá.
You should be able to change the text color for specific syntax in the colors tab. In the properties tab when you right click on power shell. Go to colors tab and edit it according

Powerpoint - want to define a color palette that is NOT a color scheme

I import Spotfire graphics into Powerpoint quite frequently. Spotfire has its own specific color palette, which aren't the standard colors used in powerpoint, at least I don't think so.
I often must create my own legend or for other reasons match the spotfire color palette, and I do this by entering the RGB codes for the spotfire colors. I would like to do this one time and have the spotfire color palette always available in powerpoint without having to re-type.
I do not think I want to use a color theme, because I want my colors to stay consistent if I end up using different templates (themes). That is, I don't want to call spotfire default blue "Accent 1", because if I change background templates (themes) I think it will overwrite Accent 1 with the new template's Accent 1.
So I want a color palette that is always available to me regardless of what theme I choose.
Any thoughts?
You're dismissing themes for all the right reasons. They wouldn't work for what you're after. You'd pretty much need to buy or write an add-in to do what you want.
For example, it might install n buttons on the toolbar/ribbon, where n = the number of colors you need on your palette. When the button is clicked it sets the fill, for example, of the currently selected shape/shapes to the appropriate color.
You could have different sets of buttons for fill, outline etc, or have the code figure out whether the user has pressed, eg the CTRL key. Click = set the fill, CTRL+Click = set the outline.
Because I was curious I decided to attempt to create a simple Add-In that will allow you to select a chart, series in the chart, and then apply colors.
You can download from Google Docs (revised link)
https://docs.google.com/file/d/0B1v0s8ldwHRYMFFPZ29FNmI0TkE/edit?usp=sharing
The file is saved as a PPTM to expose the code modules. Save As a PPAM and load the Add-in; it will be available from the Add-Ins command bar. I have tested briefly and seems to be working.
Here's the nuts & bolts of it:
First declared several custom colors as Public Const variables. These can be modified using the long value (converted from RGB) to suit whatever you need.
The macro requires that the selection be a Shape, and further that the Shape .HasChart = True. There is some logic to trap these conditions.
A user form has a ComboBox that populates with a list of Series from the selected chart, and 8 CommandButtons colored for each of the defined colors, will send that color to the chosen series.
You could add additional CommandButtons and colors as needed, or tweak the existing code to suit your specific needs.
Although the slide templates have a default color theme attached to them, you can switch slide templates and still use any XML color scheme at your disposal.

LongListSelector Foreground Color

Have been searching through here with no luck, Pretty simple problem, On my emulator all font colors are white (which is what I want).
Testing on a device the fonts are all black now, I have managed to change this by setting the foreground colors on the elements however I am unable to do so on the longlistselector through code.
This works for me:
longListSelector.Background = new SolidColorBrush(Colors.Transparent);
However this has no effect:
longListSelector.Foreground = new SolidColorBrush(Colors.White);
Any other way I can attempt to set the text color on the longlistselector?
The reason foreground colors would be different would be because of the default style. PhoneAccentBrush changes based on if your "phone" is set to have a white background or a black one.
The reason why your longListSelector.Foreground is not working may be because the phoneaccentbrush is set on the items inside the longlistselector from a style?

Wrong color in Interface Builder's color picker

I have an UIImageView with a brown image that will not always reach the top part. The UIImage view is inside a white UIView.
So, because the top part of the image is a linear brown color, I said I will make the UIView underneath it the same brown color, and the user will not see where the image ends. So far, so good.
My problem is, when I pick the color in the top part of the image, the color picker picks a more darker color than actually is there :(
Before I click the color picker:
After I click the color picker:
How comes ?
Just wanted to elaborate upon the accepted answer with some screenshots.
If you want to match RGB values between Photoshop and Xcode exactly (without conversion between colorspaces) then you need to save your images in generic RGB and enter any dropper values using the generic RGB colorspace.
When you choose "Save for Web & Devices" from Photoshop, uncheck the "Convert to sRGB" box.
In Xcode, click the colorspace popup in the color picker and choose "Generic RGB", then enter the red, green and blue values from Photoshop, NOT THE HEX VALUE as this reverts back to the sRGB colorspace for some reason (be careful not to tab to the hex field either, as that also changes the colorspace to sRGB).
More info here, including how to match screenshots.
I've managed to find out a solution/explanation (tho I'm still confused) in this answer: https://stackoverflow.com/a/9203647/460750
Basically, what I did to solve my issues, was to choose from the RGB "types" select (that little square under the color picker) the Apple RGB option, and enter the R, G and B values manually, instead of using the picker.
Odd...
Its because the component numbers don’t spec a color. We also need to know the color space which xCode uses. Colorspace which encodes or decodes is available in the drop down left to the RGB slider.
By default xCode chooses the "Generic RGB" and that is what UIColor uses spec color from RGB. If we use magnifying glass, it will change to "Device RGB” space and that is based on your current screen.
So “sRGB" or "Adobe RGB" would be the better or close to what you want if you are using the magnifying glass to pick a color.
I think Generic RGB also works.
the trick is you need to enter number of R G B manually
after change the RGB mode in dropdown list
Odd... (too)
UPDATE 10.10.4
I had this issue as well, I reported it to Apple, and it seems to have been solved on 10.10.4 (it was related to the color picker itself, not to Xcode/IB)
Can someone else confirm it?
This is an old question, but it was important for me to add some info.
The only method that has been working for me accurately over the years was to not use PS's Color Picker, but use macOS' built-in "Digital Color Meter".
It's bundled with every installation of macOS and the RGB values emitted from there with "Generic RGB" always reproduce the correct color in Xcode Storyboards.

Resources