Task 033: Nice color palette

You should implement an algorithm for computing a nice color palette based on one or two input colors (application: WWW page design = CSS color scheme, etc).
Output is a set of 3 to 9 colors, derived (tightly or loosely) from input color[s]. Use of HSV color system is recommended, as it deals elegantely with color similarity and opposition.

Base

You have to use the 033colormap project from the grcis repository. Simple WinForm-based application is ready, you need not deal with user input or displaying your result. The already declared function Colormap.Generate() is called whenever needed. It recomputes the color palette from new input settings. You have to reimplement this function, the relevant code is marked by special comments in the source file Colormap.cs:

  // !!!{{
  // !!!}}

Screenshot

Technically

Input colors are passed as arguments baseColor1 and baseColor2. Number of required output colors (palette size) is in the numCol argument (your right is to disobey this value if you have reason to..). Optionally you can use free string parameter param and pass any other information through it (in this case you should define exact syntax and semanthics of the parameter in a comment). Pilot implementation is using the parameter for passing additional float value.
Output color palette has to be returned in the argument colors, you must allocate an array of the right size by yourself, e.g. colors = new Color[ 4 ]; for four colors..

There is an initialization procedure InitPaletteData() for your convenience. You could use it for faster debugging or to init your generator with precious input just before you submit the solution.

Please send only the modified source file Colormap.cs by mail. We do not accept entire Visual Studio projects!
Fill in your name into the comment on the first source line.

Color space HSV

For converting between RGB and HSV color spaces you can use support functions Arith.ColorToHSV() resp. Arith.HSVToColor(). HSV system is using floating point components (float), .NET builtin type Color uses integers in range 0 to 255.

Inspiration

Any online sources for colormap generation, for example very nice editor Adobe Color CC (set the "Compound" mode), etc.

Submission

Source file Colormap.cs.
Your name in the comment on the first line.
The InitPaletteData() function should contain some reasonable values (your pride).
If you are using the param string parameter, don't forget to include short description of all options and allowed values.

Deadline

Due to: 8. 11. 2015

Credits

Max 9 points

Project

Visual Studio project: 033colormap.

Source file

Modify and submit the file: Colormap.cs


Copyright (C) 2010-2015 J.Pelikán, last change: 2019-05-09 17:52:59 +0200 (Thu, 09 May 2019)