Hot answers tagged color
184
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 ...
94
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, ...
48
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 ...
29
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 ...
15
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 ...
12
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 ...
11
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 ...
10
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 ...
10
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 ...
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 ...
8
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 ...
8
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 ...
7
Assuming you have one bright and one dark color for each character, you can check the difference in luminance, by converting the tile color and the NPC colors to HSL. Pick the NPC color with the greatest luminance difference from the tile.
If you don't want to manually assign both colors, you can simply hardcode:
if (tile_color.l > 0.5)
...
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
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 ...
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.
5
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 ...
5
The color picker widget you posted defines colors in HSV color space. In HSV space, a color is defined by three values:
hue: an angle between 0° and 360° which defines the color (0° is red, 120° is green, 240° is blue). In RGB terms, it tells you which channel (red, green or blue) is the one with the highest value, which one is the channel with the second ...
4
This is assuming you are storing the ASCII art as bitmaps instead of text rendering, which is better for performance, flexibility, and can facilitate easy to implement custom tile-sets.
Instead of changing the colors depending on the background colors, make all the ASCII art light toned, and have a slight drop shadow effect pre-rendered onto the bitmaps.
...
4
This is more useful for website design but the theory of how colours work together should be applicable anywhere:
http://colorschemedesigner.com/
If you’re set on 8-bit colour, just remember that you won’t have enough to do lots of intricate shading; your models can end up looking quite flat or cartoony (but that may be the look you’re going for). ...
4
sRGB is the default color space for most of todays operating systems. From Wikipedias entry about sRGB:
... one can generally assume, in the absence of embedded profiles or
any other information, that any 8-bit-per-channel image file or any
8-bit-per-channel image API or device interface can be treated as
being in the sRGB color space.
What that ...
4
A few points:
Modern video cards and drivers has a texture compression feature that pretty much defeat the purpose of this question. You get good looking textures at low memory and memory bandwidth consumption. You can't compress paletted images in the same fashion.
It is correct that you are not even close to having made a game yet? Then why are you asking ...
4
You're getting the banding because of a bad setting for colour bit depth on your surface. Romain Guy and Chet Haase (both Google employees who work on graphics in Android gave a presentation that covers these issues at the San Francisco Android User Group in 2010. The video is available on YouTube here and I've actually made some notes on the stuff they ...
4
Usually shader languages come with special types that hold multiple values.
For example GLSL has vec2, vec3, and vec4 types which hold 2, 3 or 4 float values... these types are ideal for something like RGB or RGBA values.
I don't know which shader language you use, but from your other question I'm guessing it's AGAL (Flash shader). There you use register ...
4
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 ...
4
Just wanted to throw in a reference to the Tableau-10 palette that was developed for high distinctiveness and which is described in this paper:
http://vis.stanford.edu/files/2012-ColorNameModels-CHI.pdf
"The Tableau-10 palette provides the best color salience and minimal name overlap."
4
In OpenGL 1.1 there is really no way to do this efficiently. You may be able to do something with glCopyTexSubImage2D to a GL_LUMINANCE target texture, but (IIRC) that will sum the colour channels during the copy process so you'll lose a good deal of brightness. Or you could load a second (greyscaled) copy of all your textures and use those instead, at the ...
3
The pipeline will always be floating point internally, and the hardware does the int/float conversions for you, so that part of it should be very fast. If your app is vertex-bound, either on the CPU side updating the buffer or on the GPU side reading it, then the thinner UINT format could make a difference. You'll have to measure and compare the performance ...
3
Since there is some subjectivity to any answer here, I'll offer one that is easy to understand and easy to compute. Whether it suits you and your needs is up to you.
Imagine color space represented by R, G, and B values each on the interval [0,1]. Imagine the RGB value being a vector in color space, where that vector is confined to a cube. For any RGB value ...
3
First, and since you are using only one normal channel, I would change the UsageIndex of your VertexElementUsage.Normal from 1 to 0.
And for your color channel, your vertex buffer is expecting a VertexElementFormat.Vector4, that is, 4 float components. The type used for colors in XNA is a special 32-bit encoded value, so change it to ...
Only top voted, non community-wiki answers of a minimum length are eligible