See if the color example shown in that documentation help you.
There are some Color Picker software that do by name (I imagine these are universal names). An online that does this.
The ideal would be to make a code that generates all of them, including the content you want. You can do this easily using reflection by reading all members of the class and using the colors in whatever you want. Actually someone’s already done it with another class of colors and should be very easy to adapt to your need. There are examples too.
It is possible to use any of the RGB palette, ie about 16 million colors, normally used hexadecimal (ex.: #C010FF
). The class is a facilitator with widely used colors.
Note that where a color waits for a structure https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.color.aspx
which is composed of 3 bytes, one for each basic color (there is a fourth alpha layer, but that does not matter in this context). So what you put there is a number that you can put in hexadecimal or decimal. The colors of this class are just names for predefined values, you do not put a name there but a number, the name is just to help you. It is not difficult to emphasize that variables are just names for a position in memory, which has values. There is nothing special about this.
What is special about XAML is that it identifies itself whether it is using a name or value. This is done internally through type converters, but you don’t even need to know it to use.
And how would I use a color that is not in the class? In my case I am changing the color of the title bar and window buttons with
var titleBar = ApplicationView.GetForCurrentView ( ).TitleBar;
andtitleBar.BackgroundColor = Colors.DimGray
. In my case I want a darker gray than those available in class.– Matheus Saraiva
@Matheussaraiva using hexadecimal that defines a color, as I said in the answer. Where it accepts a color it accepts the structure https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.color.aspx. What it puts there is always a color code with 3 bytes, one for each color. The class
Colors
only has some numbers ready for use in specific names.– Maniero
Actually my question is how I should insert hexadecimal. That is, as String or in some method that receives an Hex string and converts to one
Color
. I used the @rubStackOverflow response, and discovered the methodColor.FromArgb(int a, int r, int g, int b)
. Working well now, but if there is a way to pass an Hex, I find more practical.– Matheus Saraiva
@Matheussaraiva you saw the documentation that I Linkei? There are examples of use. If it is XAML you can use direct hexadecimal as string, Otherwise you will have to fill each property (each color) of the structure with a number. You can do using hexadecimal or decimal notation if you prefer.
– Maniero
So I searched there is no way to modify the colors of the title bar and close, maximize and minimize buttons of the window via XAML. I’m doing this via C# code on
App.xaml.cs
. I researched some more and it seems that there is nothing ready, where the solution is to create a method that does the conversion as in http://stackoverflow.com/questions/28782399/converting-a-string-hex-to-color-in-windows-phone-runtime-c-sharp– Matheus Saraiva
Just correcting. The parameters of
FromArgb()
are of the typebyte
and notint
– Matheus Saraiva
@Matheussaraiva is possible.
– Maniero
On second thought, you’re right.
App.xaml.cs
is nothing more than the code-Behind of theApp.xaml
.– Matheus Saraiva