How do I indicate success and failure with colour? - colors

I need to make a Java component that turns the background a certain colour when a process passed, and another colour when the process failed.
My first thought was: green for success, red for failure.
But then I read that 10% of males can't differentiate between these two colours. What would be a better combination of colours?
(For the nitpickers: yes, I know that colour alone doesn't suffice, that text, shape, and noise can also be used. Nevertheless I am asking about the appropriate use of colour.)

Red + x = Failure
Green + checkmark = Success

I think you've answered this yourself. Use green/red in addition to text. Most people will understand green/red. If you change it to blue/yellow, the 90% who see green/red will be confused. Stick w/ the convention and add text to help the 10% who can't see green/red.

Remember that these "obvious" color associations (green=good, red=bad) are culturally variant. Thus, not relying on only the color is a very good idea.

Use color and sign. Green with a "+" and Red with a "-", This way people that can't see color will understand.
If it's background color of grid line, to solve the problem, add a column called "State" and use an Icon + or -.

In my opinion the best way to go about this is to use a mix of colour and icon/text.
For example, when I have errors on my form I do the following:
Provide a text header on the top of the form stating something ala: "Oops, there was some issues with your submissions: Last name was not filled in, etc.."
On each error field, I highlight the background of the box pink and modify the border. Not only does it change the colour, it also puts a subtle, but noticeable focus on the error field.
Finally, depending on the site and amount of space I have I append a little "warning" icon with a small message after that field.
With all those 3 combined, the error form is easy to read and hard to miss what's going on for all people.

As a person with Red/Green colorblindness, I can easily tell the difference between the two colors in their "pure" form. The issue is that red tends to look "washed out" -- more of a brown and greens/yellows merge together. Of the 8% of males who are colorblind, I do believe that very few are completely unable to differentiate between pure Red and pure Green. The issue is that the exact color of the sweater I'm wearing or the Autumn leaves can be difficult and confusing. In addition, I DO have a hard time with any LEDs and particularly traffic lights; they can be confusing mainly because I've become more tied to the relative brightness than the hue and some signals vary dramatically in brightness.

Maybe a visual representation of a traffic light? In a neutral state, all three lights are greyed out, although still discernible by colour. In a "green" state, the green light is brighter, and the contrast between the background and the light is increased. Same for the red-light state.
I have to admit that
I don't know if the red-amber-green configuration of UK traffic lights is a worldwide standard that would not be open to interpretation, and
Whether the contrast between the light on and light off states would be enough for a visually impaired user to differentiate between them.
Just an idea...

We generally implement it like this:
We have written 2 common functions in which
we format the string with {0} for error fmsg and green for success.
So instead of using 2 different labels for error (red) and success (green) msgs you can use one single label and control the msgs and their type (success and error) on server side code itself.
But since , ppl for color blindness : use images X for error with the same above way to implement or even orange for error and blue for success is also a good option.

Don't use pure red and green. On safety devices such as traffic lights, the red is actually a red and orange mixture. If I remember correctly the green is also mixed with a little yellow.
It still would be a good idea to use a secondary method to indicate success/failure in addition to color. This can be text, a symbol, or something that attracts attention such as have the red failure back ground be an alternating color that flashes instead of being static. For example alternating the red with yellow.

To be honest, shape/position is almost always a more important solution than colour. There are aspects to colour, such as the human eye's insensitivity to blue, that mean that colour's an aid to clarity, and you can't neccessarily rely on it to be appropriate.

Related

How does a computer evaluates the color code?

I just want to know that how does a computer know that the value rgb(255, 0, 0) is red or how does it know that a particular color code is for a particular color?
What I want to say is that how computer know that
red means red,
green means green,
white means white,
blue means blue so on.
Please explain it without taking an analogy. I want to know the real thing happening behind the hood.
Your computer doesn't need to "know" anything about what a color "means", it just has to pass the numeric values of the R, G, and B components of a color value to your monitor, which is wired up to emit corresponding levels of red, green, and blue light. (That's oversimplifying a bit, because all sorts of color processing might go on first, but that's still the gist of it.)
Different levels of those different colors, when mixed together, produce the wide gamut of colors that your monitor can produce, and from there, it's a matter of how your brain processes that mix of primary colors that determines what colors you see.
The computer doesn't know the meaning of red (nor the meaning of the letter A).
Computer get the data (255, 0, 0) and it put it in memory, telling that pixel X has such values. Really graphic libraries handle the position of the pixel, knowing the coordinates, and also knowing the colour deep, now often we have 32-bits per pixels, with a consistent pattern.
Video card will read the memory, interpret it and convert to a standardized signal (e.g. HDMI, SRGB, 8bit per channel, progressive, 4:4:4 colour configuration, screen-size AxB, data speed, etc.), and it will send it to the screen. If screen can interpret such data flow, it will send it to the pannel, and pannel will illuminate the pixel (often it will just allow the backlight to pass thru it, with a specific intensity). A colour filter is applied over every pixel so you get (your eyes) a specific colour. If you displace the colour filter, there is no way computer, video card, screen, and panel will know about you are seeing different colours).
So: computer handle just numbers. Libraries and computer languages handle the interface user (or better programmer) to data, so that you can write "red" in CSS, or #FF0000 in HTML, or 255,0,0. Then one ore more libraries (e.g. moving windows, transparency) will handle data, having some information about structure (system setting for your screen). Video cards, screens, and pannels will know very few about the meaning of data.
Note: operating systems, video cards, and screens may change the meaning of the colours. It is usually done in colour profiles, to get better colours according hardware, but there are also test ICC files which just invert colours (or used for high contrast, or colour blind people). In such case computer have no idea that "red" will be displayed as "black" (as an example).
You should always think as "sandwich": semantic (so real meaning) should be known only on first input and last output. For the rest, computers is just working with numbers (and they may not know anything about semantic). Sorry for the unwanted analogy.

Is this scenario thread safe in libgdx?

I am working on a game in libgdx, my partial scenario is this
1: I have got 5 squares which I fill every 10 second and once they all are full[50 sec] nothing is done. I fill them by coloring them to blue from red which is by default.
2: A button which has its operations, one of those operations is that it will fill one of these square(color changed from red to blue.)
Here is the set up
act(float)-------calls---> updateSquare
updateSquare ---> checks whether it has been 10 second since last time, if yes then grab the first square available and change the color.
buttonListener ----> change the color of the first square available to blue from red.
Now my question is that whether it is thread safe? Will these threads overlap with each other?
Let's say my first two square are red and rest are blue so the first available is 3rd one, so if first updateSquare is called and than I click the button then two new squares will be turned blue and total four blue squares.
However if both happen at the same time(updateSquare and buttonClick) then both of them will make only the 3rd square blue.
Is this scenario(overlap) possible? My friends it is not and I also don't face any problems like this, but I don't know whether it is thread safe or not?
See this link:
Events are dispatched right before the call to ApplicationListener.render(), on the rendering thread.
What this means is that you actually do not have any multithreading here. All events (like the one your buttonListener receives) get collected during one frame. And they are dispatched to your handlers right before the next render call.
This is completely deterministic and there are no overlaps.

Android SMS Messaging like UI

I'm going to make an app which will require messaging. Now I have questions about making the messaging UI. I want to make it similar to Go SMS Theme Minimal UI
I am assuming that I'll have to use listview and 9 patch png.
But I need a expert advice.
I would say that that is a good approach. You will definitely need a list view, the real question is just how to build the list item background.
Looking at the image you shared, the pointy part of the box (outlined in red) is really all that can't be stretched, so you could make a 9 patch similar to this.
The top and left are the important part, they tell the 9 patch which parts can be stretched (or repeated, really. The bottom and right tell it which parts can contain content. So if you always need a certain amount of padding then you can use those to define that.
I'm not a designer, but what I like to do is take an image like this, obviously trim out the content, then trim it down in the middle so one black line on either part (top/bottom, left/right) is only 2 pixels wide. This allows the smallest possible asset so you don't load as large of a bitmap, but still gets all of the appropriate information.

How to check if two pictures "touching" each others?

I'm writing a game in wich the user is having a spaceship and need to "kill" some enemeis that wiil try to kill him back.
I have a "Texture 2d" for the user's spaceship picture,a bullet picture and an enemy picture.
I would like to know,after the user has shoot the bullet to the enemy,how can I check that the bullet has hurts the enemy?
In other words - what function checks that one picture is "covering" (even partial) another one?
Thnx!
:-)
Please have a look into the topic "2D Collision Detection". As you are using XNA the following site should give you a good start:
http://www.progware.org/Blog/post/XNA-2D-Basic-Collision-Detection.aspx
Basically you need to detect when two non-transparent pixels are overlapping, but to prevent unnecessary calculations, you first check if the bounding box for your ship and the enemy ships is even overlapping (since the pixels won't overlap if the bounding boxes don't).
Riemers.net has a good tutorial. Here's a good sample project on per-pixel collision detection from the app hub.
I'm unaware of any pre-existing API functions that do this, but implementing it yourself will be a good exercise.
You should know the x/y coordinates of each of your picture's origins. You should also know the dimensions of each picture.
You can calculate the bounding box of a picture, and whether there exist any points in common.

NES Programming - Nametables?

I'm wondering about how the NES displays its graphical muscle. I've researched stuff online and read through it, but I'm wondering about one last thing: Nametables.
Basically, from what I've read, each 8x8 block in a NES nametable points to a location in the pattern table, which holds graphic memory. In addition, the nametable also has an attribute table which sets a certain color palette for each 16x16 block. They're linked up together like this:
(assuming 16 8x8 blocks)
Nametable, with A B C D = pointers to sprite data:
ABBB
CDCC
DDDD
DDDD
Attribute table, with 1 2 3 = pointers to color palette data, with < referencing value to the left, ^ above, and ' to the left and above:
1<2<
^'^'
3<3<
^'^'
So, in the example above, the blocks would be colored as so
1A 1B 2B 2B
1C 1D 2C 2C
3D 3D 3D 3D
3D 3D 3D 3D
Now, if I have this on a fixed screen - it works great! Because the NES resolution is 256x240 pixels. Now, how do these tables get adjusted for scrolling?
Because Nametable 0 can scroll into Nametable 1, and if you keep scrolling Nametable 0 will wrap around again. That I get. But what I don't get is how to scroll the attribute table wraps around as well. From what I've read online, the 16x16 blocks it assigns attributes for will cause color distortions on the edge tiles of the screen (as seen when you scroll left to right and vice-versa in SMB3).
The concern I have is that I understand how to scroll the nametables, but how do you scroll the attribute table? For intsance, if I have a green block on the left side of the screen, moving the screen to right should in theory cause the tiles to the right to be green as well until they move more into frame, to which they'll revert to their normal colors.
~~~~EDIT:
I do want to point out that I know about the scanlines, X and Y. This thought just ran through my mind.
Let's say I'm at scanline Y of 10. That means I'm reading 10 values into my nametables, horizontally. That would mean my first column is off of the screen, as it only has pixel width of 8. However, the color attribute stays, since it has width of 16.
Assuming the color attribute for the entire column is green, would I be correct in assuming that to the user, the first 6 pixels on the left of the screen would be colored green, and the rightmost 10 on the screen should be green as well?
So, would I be correct in my assumption that according to the screen, the left?
This site I'm sure you are already very, very familiar with. I will preface this by saying I never got to program for the NES, but I am very experienced with all the Gameboy hardware that was ever released and the NES shares many, ahh quirks with the GB/DMG. I going to bet that you either need to do one of a few things:
Don't scroll the attribute table. Make sure that your levels all have similiar color blocks along the direction you are moving. I'd guess that many first generation games did this.
Go ahead and allow limited attribute scrolling - just make sure that the areas where the changes are occuring are either partially color shared or sparce enough that the change isn't going to be noticable.
Get out your old skool atari 2600 timer and time a write to register $2006 in the end of HBlank update to get the color swap you need done, wait a few tics, then revert during the HBlank return period so that the left edge of the next line isn't affected. I have a feeling this is the solution used most often, but without a really good emulator and patience, it will be a pain in the butt. It will also eat a bit into your overall CPU usage as you have to wait around in interrupts on multiple scan lines to get your effect done.
I wish I had a more concrete answer for you, but this hopefully helps a bit. Thanks goodness the GB/DMG had a slightly more advanced scrolling system. :)
Both Super Mario Bros. 3 and Kirby's Adventure display coloring artifacts on the edge of the screen when you scroll. I believe both games set the bit that blanks the left 8 pixels of the screen, so 0-8 pixels will be affected on any one frame.
If I remember correctly, Kirby's Adventure always tries to put the color-glitched columns on the side of the screen that is scrolling off to make it less noticeable. I don't think these artifacts are preventable without switching to vertical mirroring, which introduces difficulties of its own.
Disclaimer: it's been like five years since I wrote any NES code.
Each nametable has its own attribute table, so there should be no graphical artifacts when scrolling from one nametable to another. The type of color glitching you are referring to is really only an issue if your game scrolls both vertically and horizontally. You only have two nametables, so scrolling both ways requires you to cannibalize the visible screen. There are various solutions to this problem, a great summary of which can be found in this nesdev post:
http://nesdev.parodius.com/bbs/viewtopic.php?p=58509#58509
This site may be of some help.
http://www.games4nintendo.com/nes/faq.php#4
(Search for "What's up with $2005/2006?" and begin reading around that area.)
It basically looks like its impossible to get it pixel perfect, however those are going to be the bits you're probably going to need to look into.
Wish I could be more help.
Each nametable has its own attribute table. If you limit your game world to just two screens, you'll only need to write the nametables and attribute tables once. The hard part comes when you try to make worlds larger than two screens. Super Mario Bros. 1 did this by scrolling to the right, wrapping around as necessary, and rendering the level one column of blocks at a time (16 pixels) just before that column came into view. I don't know how one would code this efficiently (keep in mind you only have a millisecond of vblank time).

Resources