# Tag Info

284

You could generate equidistant hue values in the HSV space: for (int i = 0; i < 10; i++) colors[i] = HSV(0.1 * i, 0.5, 1.0); However, itâ€™s possible that you will not always have 10 players. In that case, the palette would not be very efficient unless you re-generated a different palette for another number of players. Instead, some authors ...

149

The 8 StarCraft colors are: Red, Blue, Teal, Purple, Orange, Brown (green in desert maps), White (green on ice maps), Yellow Obv. Blizzard are UI geniuses and have studied the problem. They left Green out as a swap-in for Brown on desert maps, so technically there are 9 listed there. The 12 Warcraft 3 colors are: Red, Blue, Teal, Purple, Yellow, ...

69

A few people here recommend dividing up HSV color space at 10 equidistant positions on hue. In my opinion, this is actually not a good solution. The human eye does not perceive differences in color equally across the HSV spectrum. For example, what we'd call orange occupies a tiny slice of the band, whereas a good 25% chunk might qualify as green. So it ...

43

To me it makes no sense at all. This theory is probably just an artist sense of white balance compensation that the eye does, and wrongly gives us the feeling of shifted hues in the shadows. A shadow is just the absence of light from the considered light source. There are other light sources often in a realistic world, this is their color that comes in place....

40

A quick and easy way - though not 100% precise one - is to consider just the five extreme points white, black, red, green and blue. First, let's transform RGB into linear space. Officially this is usually done by this formula (assuming the source data is in sRGB, which is the default for most graphic card operations on 8-bit data and nearly every image you ...

37

Digital colors can be made up of three components: red, green, and blue. Combine these together, and you get final color, eg. yellow is 100% red, 100% green and 0% blue. The fourth component is, as you mentioned, transparency. Together, these form the tuple RGBA (red, green, blue, alpha) which represent an image. Now, instead of pixels, think about it ...

33

You can use the fact that colors make up a (three dimensional) color space and calculate a distance in this color space. You then need to define a metric in this color space to find the distance between two colors. E.g. the distance in a euclidean space between two points x = (x1, x2, x3) and y = (y1, y2, y3) is given by d(x,y) = sqrt( (y1-x1) * (y1-x1) + (...

24

I thought I needed to break this "symbols" approach out into a separate answer. Back in the day, I assume people needed flags and stuff to easily identify an army way off in the distance, so you know whether to attack or defend (in case of foes), or be relieved (in the case of allies). So, incidently that's exactly what you're trying to do. Easily ...

19

Making 10 colors that can be distinguished is going to be really difficult. This is a pretty common issue in creating graphs or charts for many values, which is why they often use color and shape or color and hash pattern combinations. If you need to display markers, you can use 4 basic colors (red, blue, orange, black for example) and four basic shape (...

18

Hue-shifting is one possibility that would let you get a range of colors without losing the color details. The basic idea is to convert each pixel from RGB to HSV space, then offset the hue by a user-defined amount, then convert back to RGB. Actually, this can be done more efficiently by applying a rotation matrix to the RGB values: create a matrix that ...

17

Why reinvent the wheel? There even is a standard for a set of sixteen colors, of which you could pick ten. This is the ANSI set http://en.wikipedia.org/wiki/ANSI_escape_code#Colors The ANSI color are equally distributed on the RGB cube, which is, I think, better suited for this problem than the HSV space. When taking the extremes of the RGB cube, you get ...

14

I don't know if there exists a set of colors that all people will be able to differentiate, whether or not they have any color-blindness. It might be a better idea to use an additional indicator alongside color. I know that the Ticket To Ride boardgame uses a symbol on each of the different color cards, so that if someone can't tell the difference between ...

14

For drop-shadows it doesn't work very well for the reasons you already stated. You never know how many drop-shadows you will have in the scene and differently colored shadows from different objects can look strange. However, it can work nice for self-shadows, especially in a 2d game. This screenshot is from Seiken Densetsu 3 (Squaresoft 1995): Notice how ...

13

Humans have trichromatic color vision, so the space of colors we can see is fundamentally three-dimensional. (Well, for most of us, it is. Colorblind people may only have dichromatic or monochromatic vision, and there may be a small number of people who can (barely) distinguish an extra dimension. Also, technically, even normal humans do have a fourth ...

13

There are a huge number of ways of doing this. These will require the use of a shader and I am presuming that you are already doing per-pixel lighting. The following are some suggestions, however finding the technique that's right for you might take a lot more research. Quick and Dirty You can specify bounding boxes which define interior areas. If the ...

11

let Arr be an array of Colour let N be the number of colors in the array let t be the 0..1 float value float scaledT = t* (float)(N-1); Color prevC = Arr[(int)scaledT]; Color nextC = Arr[(int)(scaledT+1f)]; float newt = scaledT - (float)((int)scaledT); finaly you can use Lerp Color.Lerp(prevC, nextC, newT)

10

White is the best base color for true representation. Also keeping your sprite grayscale can make for some easy color adjustments for teams, etc. Unity applies a Multiply blend mode to the sprite texture and color. Unity's Color type is ranged from 0 to 1 inclusive. Color.White is equal to (1, 1, 1, 1). Knowing that 1 times anything is itself. If the ...

9

It's much more complex than that. It's not the colors themselves that look attractive, it's the combination of colors, the contrast between them. In a picture only out of bright colors, there is a lack of contrast, same for a picture only consisting out of dull colors. In a picture out of dull colors bright spots will immediatly jump into the eye, this can ...

9

If you use alpha blending you can lay down a complimentary shadow that will work against any background. It may or may not be any better or faster though. This is something that is likely to change depending on your specific game. I don't have enough rep to comment on @v.oddou's answer, but I want to say that while purposefully making shadows complimentary ...

8

I'd probably use a single color image (eg. your note-sprite) with alpha channel and then color the whole image with your base-color. So, something like in the following image (from wikimedia commons): If your color was red, you would then color the note (all the black parts) with the same red. What you would need in addition, is a grayscale image with the ...

8

The most contrasting color would be the color that is as far as possible from color X. It's easy to get it this way (assuming 0,0,0=black and 1,1,1=white -- floating point colors): y = rgb_color( x.r > 0.5 ? 0 : 1, x.g > 0.5 ? 0 : 1, x.b > 0.5 ? 0 : 1 ); The result is quite ugly though, so you might want to consider a few more things:...

8

Just to distill Martin Sojka's excellent answer into something simple to apply, here's how to decide whether black or white text would have higher contrast on a given background color (R, G, B) in the sRGB color space: const float gamma = 2.2; float L = 0.2126 * pow( R, gamma ) + 0.7152 * pow( G, gamma ) + 0.0722 * pow( B, gamma ); boolean ...

8

The problem you are facing is that you can't simply "tint" the whole image, the appearance you see is more than just a base color. For one you have fine gradients from one one material to the other, but more importantly you also have reflections,highlights and shadows, which are not influenced by the base color. (Those are basically added on top of it.) So ...

8

The United Nations web accessibility standards page (http://www.un.org/webaccessibility/1_visual/13_colourcontrast.shtml) does indicate a standard for ensuring proper text contrast on websites, keeping in mind that some users are colorblind. This might be particularly important for you since some of your users may be colorblind as well (would be hard to tell ...

7

You could programmatically make a mask by converting the image to HSV color space and specifying a hue range that captures the yellow parts you want while leaving alone the rest of the colors. For instance, you might select the pixels with hue between 50 and 70 (assuming yellow is a 60). Then do the tinting by adding an offset to the hue of those pixels, ...

7

Even if you can get 10 unique colors that are distinguishable easily by one person, another person may still find this set harder to distinguish. Consider limiting yourself to a smaller set of colors, and adding a distinguishable feature, like a black stripe. For the set of colors, it's probably best not to stray too far from what most people can ...

7

If you want to have a colour-picker with Hue on one axis and Saturation on the other, it might be good to think of your colours in terms of the Hue-Saturation-Value (HSV) or Hue-Saturation-Lightness (HSL) colourspaces instead of Red-Green-Blue (RGB). There's no magic going on here -- HSL and HSV are just another another way of thinking about colour. ...

7

The term comes from the definition of "channel" that means a specific portion of a frequency spectrum. In this case, the red, green and blue components of a color are often referred to as "channels" (since red, green and blue light are portions of the visible light spectrum). Since alpha is another component of color in computer graphics (although not one ...

6

At midday, RGB of (1,1,1) or plain white light. At sunrise, a little more blue looks pretty good. Tweak until you have good results. At sunset, a lot more red looks good. Tweak as above. At evening or night, go with a dark blue. This isn't really based in reality but it's common enough.

Only top voted, non community-wiki answers of a minimum length are eligible