How should I choose the accents for Mahapps Metro - mahapps.metro

I am looking at creating custom Accents for the Mahapps Metro. I see in the link Creating Custom Accents and Themes the following;
<!--ACCENT COLORS-->
<Color x:Key="HighlightColor">#FF9F0055</Color>
<!--80%-->
<Color x:Key="AccentColor">#CCD80073</Color>
<!--60%-->
<Color x:Key="AccentColor2">#99D80073</Color>
<!--40%-->
<Color x:Key="AccentColor3">#66D80073</Color>
<!--20%-->
<Color x:Key="AccentColor4">#33D80073</Color>
The AccentColor has a comment of 80%. What does that mean? 80% of what?
Or for example if my HighlightColor is #FF004E9B what would be the 80% color of this?

After asking the question the only thing I could find on this was this answer on creating a full resource accent/color.
In this example the only thing that is changed is the alpha channel of the ARGB.
Color.FromArgb((byte)(204), originalColor.R, originalColor.G, originalColor.B)
This would be the first accent Color or 80%.

Related

ActionBar text color via Codename One

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?

WPF In-Code Preview Colour Feature VS2019

I would like to know if there is a setting for WPF in VS2019 to enable "colour preview" in code, such that when I type the hex colour code it displays the colour (without having to apply the colour to any UI element – just a pure visual preview)?
I have a project, where I use a multitude of colours, and it is getting difficult to keep track of which colour is which, so it would be nice to have a visual guide.
My general code for colours in the Resource Dictionary is:
<Color x:Key="BackgroundLight">#efefef</Color>
<SolidColorBrush x:Key="BackgroundLightBrush" Color="{StaticResource BackgroundLight}" />
Is there such setting in VS2019? I believe I saw something like this in one youtube video, where the hex code was underlined by the corresponding colour, but I can neither figure out how to achieve that, nor can I find the video now.
The newest version of VisualStudio implements this by default now. There is a coloured square next to the colour’s name. Nice.
You can sometimes persuade the colour picker to appear in the properties window.
It is fiddly though and I must admit I can't recall trying with vs2019.
EDIT:
Having just tried this, I couldn't get it to work with just a color. A control like say the background on a grid with the hex in it works ok but the colorpicker doesn't respond at all when I select a color resource.
There's a vsix
https://marketplace.visualstudio.com/items?itemName=NikolaMSFT.InlineColorPicker
Like you're doing, I usually define colours in a resource dictionary so they have meaningful names.
Once I've done that, the actual colour matters a lot less.
There's a vsix
https://marketplace.visualstudio.com/items?itemName=NikolaMSFT.InlineColorPicker
This extension can't be installed in VisualStudio 2019 Pro, but you can use this method mentioned in another answer as workaround to install it in VisualStudio 2019 Pro.
https://stackoverflow.com/a/62040646/7387963

Change the color in the TextBox in MaterialDesignInXAML

How do you change this blue color in MaterialDesignInXAML?
I try to overwrite the style but there is no option to change the color or it is under some strange name that is not in the documentation.
The colour comes from the primary accent color that has most likely been specified in the App.Xaml file.
It will look something like:
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml" /
Changing this will change the primary color for all the application.
If you need to change just for the floating hint style, create a new style based on the floating hint style setting the Foreground and BorderBrush colors.

Recolor a given DrawingImage in WPF (in code)

I have a DrawingImage which I have converted from SVG by the magnificent Svg2Xaml plugin. This way I can let the users easily define the visuals of some elements in my application.
There are some use-cases where I would like to recolor the given DrawingImage. The simplest case would be to make it grayscale.
Is there a way to recursively go through all the elements, get their color and switch it to their grayscale counterparts? Or - for example - use something like a "filter" on the whole image?
I'm not really experienced in WPF, but if this could be done it would make my work a lot easier.
What would be my best choice?
Also it is important that the DrawingImage uses vector graphics, so I wouldn't want to pixellate the image.
Converting my comment to an answer:
for the specific case of making a Visual grayscale, you may want to take a look at the Shader Effect Library
U might need to look at the WPF resource dictionary, and use DynamicResource
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Color x:Key="FrontColor">White</Color>
<SolidColorBrush x:Key="Foreground" Color="{DynamicResource FrontColor}" />
</ResourceDictionary>

Change Caret Color in WinRT?

So in WPF and Silverlight you could set the caret color for TextBox using TextBox.CaretBrush, but in WinRT it seems in all their wisdom they removed this property. So now if the TextBox is a dark color, since it defaults the caret color to black you can't see it, and if the background color of your TextBox is black the caret ceases to exist completely. I find this completely illogical, there has got to be a way to change the caret color, either pragmatically or something?
Does anyone have any ideas?
This is not possible. You need to switch your TextBox to light background when it has focus so the caret is visible.
A little late to the party on this question but I ran into the same issue and found an easy work-around. On the Windows 8.1 RT preview I noticed that overriding the TextBoxForegroundThemeBrush changes the caret or cursor color for TextBox.
<SolidColorBrush x:Key="TextBoxForegroundThemeBrush" Color="#FFFFFFFF" />
Typically the cursor is always black, even when you override the Style and ControlTemplate. I happened to stumble on this by looking in the ThemeResources.xaml that Filip mentioned above. I'm not sure if this applies to pre-8.1 xaml, Microsoft seems to have cleaned a lot up in new SDK.
I got this working by overlaying a transparent canvas overtop of the TextBox, using SelectionStart and GetRectFromCharIndex to obtain coordinates, then on KeyDown, KeyUp, and MouseDown I set the coordinates of a Line and use a TranslateTransform to move it, works great and performance is fantastic!
Not sure why I didn't try this first, I've done Transforms in Silverlight and WPF many times prior. I guess the subtle differences in WinRt kind of threw me for a loop...

Resources