How do I create a color that matches the current visual style?

For our winforms application, we were asked to color the invalid cells in DataGridView

red. We need to find a red color that matches the current visual style, but which is still different if the user has selected a palette, mostly red. How do I create a color that matches the current visual style? How can I avoid collisions?

+1


a source to share


5 answers


I don't think the original poster wants to make a palette of colors (colors), instead it tries to highlight the invalid cell. The selected highlight color is red, but he is concerned that the red may not stick out if the user has selected a red palette.



How about this: when drawing an invalid cell, use SystemColors.Window for text and SystemColors.WindowText for background. (or any DataGridView equivalents). This way, you are guaranteed that the invalid cell will be the opposite colors of the normal cell.

+3


a source


I think you are looking at this the wrong way. Red is often chosen for several reasons. This (in Western culture among others) is commonly used to depict that something is wrong or in danger. But red is also the color that usually stands out. However, when trying to draw users' attention to something on the page, there are two surefire methods.

1) Animated gifs or videos (annoying like f ***) or

2) Color collision

Usually red is highlighted, but in a situation where a user might have a red themed style, it is best to go with a color that comes across. You can combine colors that go together (if that makes sense).



Here are a few sites I've used in the past to help me find color schemes that might help you:

Kuler , Color Combinations and the Color Scheme Designer

It may not have been the answer you were looking for, but I hope it helps

+1


a source


The question is a bit ambiguous and a bit subjective; it is much easier to comment on examples. However, there are many online tools out there to help you create color palettes for websites, and these can be useful for assessing how a particular shade of red interacts with various other colors.

Hope it helps.

+1


a source


Perhaps you try to use the Light and Dark methods of the ControlPaint class? I am doing something similar, albeit in the opposite direction. I needed to highlight multiple lines in the grid, but not stand out as much as the selected rows. So I created a color that was slightly lighter than the default selection color:

        checkedColor = ControlPaint.Light(grid.DefaultCellStyle.SelectionBackColor, 1.65f);

      

One could try using this, perhaps with some added logic, and base it on some system color that stands out. For example System.Drawing.SystemColors.HighLight

or System.Drawing.SystemColors.HotTrack

.

+1


a source


take a look at the Krypton Toolkit ( http://www.componentfactory.com ). They offer free tooling for WinForms controls using a theme manager. This theme manager provides out-of-the-box methods for retrieving the current color values.

I have nothing to do with them. I am using it for my own product (Royal TS at http://www.code4ward.net ) and found it really useful.

If you want to create a beautiful user interface, you should take a look at the Krypton material.

0


a source







All Articles