Colour Theory: I have an ActionScript 3 project that has models that wear changeable clothing, where the style and colour of the clothing can change. The clothing is composed of several layers (colour, border, details) and there are preset colours for the 'colour' layer. When the colour layer changes I need to automatically calculate a contrasting colour for the border layer. I know this involves the HSV colour space but I'm struggling to get good results.
The mechanic is simple, click to change the clothing on the model. Each item of clothing is composed of several layers:
- colour, the main shape of the piece of clothing
- border, the outline of the element, showing folds, creases, seams, etc
- details, extra elements like buttons, zippers, etc
There are a set of predefined colours for the colour layer so changing the colour of the clothing should result in changing the colour of the border. By default the border is a dark colour, somewhere between black and white. If the clothing changes to a light colour, the dark border works fine. If the clothing is changed to a dark colour the border then blends in with the colour and looks terrible, the clothing just looks like a dark blob.
The solution is to pick a contrasting, neutral colour for the border layer. I've tried to do this by converting the colour to HSV values then picking a colour where h=0, s=0, v=(255 - current v). This should give a contrast but it results in mostly greys.
Is there a better way to programatically calculate a good, contrasting black/white shade for the border? I have written a class that converts freely between HSV, RGB and Hex so I can work in any of those colour spaces. I think HSV is the best one to work with but I'm struggling with the logic of how to alter the S and V values to get a good contrast.
http://ask.metafilter.com/27289/color-me
posted by miniape at 12:03 PM on February 13