views:

168

answers:

5

For our winforms application, we've been asked to colour invalid cells in a DataGridView in a red colour. We need to find a red colour that matches the current visual style but which is still distinctive if the user has chosen a palette with mostly reds. How do I create a colour that will match the current visual style? How do I make sure I avoid clashes?

+1  A: 

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

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

2) Clashing colours

Usually red stands out, but in your situation where a user may have a red themed style, your best bet is to go with a colour that will clash. It is possible to have clashing colours that go together (if that makes sense).

Here are a few websites that I have used in the past to help me find colour schemes that may help you as well:

Kuler, Color Combos and Color scheme designer

This may not have been the answer you were looking for but i hope it helps

Darko Z
+1  A: 

The question is a bit ambiguous and a little subjective; it much easier to comment directly on examples. However, there are a multitude of on-line tools that will help you create colour palettes for websites, and these may be useful to gauge how a particular shade of red interacts with various other colours.

Hope this helps.

CJM
A: 

Hi,

take a look at the Krypton Toolkit (http://www.componentfactory.com). They offer a free toolkit for WinForms controls with a theme manager. This theme manager provides ready to use methods to extract the current color values.

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

If you want to build beautiful UI, you should take a look at the Krypton stuff.

Stefan Koell
+3  A: 

I don't think the original poster is looking to make a palette of colors (colours), instead he is trying to highlight an invalid cell. The chosen highlight color is red, but he is concerned that red might not stick out if the user has chosen a red palette.

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

NascarEd
That's how I'd like to do it - using colours from the SystemColor class - but the customer has asked for red.
Simon
+1  A: 

You could maybe try to use the Light and Dark methods of the ControlPaint class? I do something similar, although kind of in the opposite direction. I needed to make some rows in a grid stand out, but not stand out as much as the selected rows. So I created a color that was a bit lighter than the default selection color like this:

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

Could try to use that, maybe with some added logic, and base it on some system color that is made to stand out. For example System.Drawing.SystemColors.HighLight or System.Drawing.SystemColors.HotTrack.

Svish