Assignment 115: Color palette for mandala

Your task is to design and implement automatic calculation of a nice-looking cyclic color set for use in "mandala"-style drawings. For an inspiration, see this video. The main idea is that the colors should go well together and have a cyclic topology (i.e. the last color in the set is followed by the first one). The output is a set of 5 to 40 colors. It is up to you to decide what system to calculate the palette you will use. We will only (subjectively) assess the final result.

Screenshot

Template

The 115colormandala project from the repository grcis will serve as a basis of the solution. A simple application is prepared in which the user defines the number of colors and can also enter several parameters in the Param: text box. According to this data your algorithm should build a set of colors (Colormap.Generate()). You do not need to implement anything else, the WinForms application will will take care of displaying the color palette. You will edit your changes in the source file Colormap.cs. The significant places are marked with curly brackets:

  // {{
  // }}

You do not need to restrict your code edits to the area marked with these brackets. Of course you can add some auxiliary class, data structure, etc. However, you must concentrate all the modifications into the single submitted file.

Technical details

The Colormap.Generate() function will get the required number of colors in the parameter numCol (you do not have to follow it strictly - you may use a different number, if you have a serious reason to do so, e.g. when your palette length needs to be divisible by four etc.). The string string param containing the Param: text field from the form is also passed. The format of this text is entirely up to you. We recommend that you do not complicate the input too much and always attach an instruction manual to the solution.

The generated palette should be written into the output array colors, that you need to allocate to have the correct size, e.g. using colors = new Color [  6  ]; for six colors.

Parsing parameters from the text field: You may use functions from the supporting library Util. An example is given in the pilot implementation: Util.ParseKeyValueList( param ); first breaks the text into comma-separated sections, and then searches for definitions in the form <key>=<value>. See the pilot implementation example (the function bool Util.TryParse( p, "name", ref val ) returns true if the key was found, and the val parameter is overwritten at the same time.)

You can also enter a brief parameter help text in the InitParams() function. This text will show in the form of a "ToolTip" whenever the mouse pointer stops over the text field. See the pilot implementation.

What to hand in

As a solution, send only the modified source file Colormap.cs! (remember to return your name in InitParams()). I will not accept whole VS projects. If you use any interesting set of parameters, you can use the function InitParams() to return them as a default. Write any other nice combinations in the comments in the source file or in the accompanying email.

Support

You may need functions for converting between color spaces, etc. You can find them in common/MathSupport.cs. The RGB<->HSV conversions are directly demonstrated in the pilot solution.

Inspiration

Various online sites for generating web-palettes, such as Adobe Color CC (formerly Adobe Kuler), etc.

Deadline

The solution is due: 4. 11. 2018

Points

8 pts for a non-trivial solution (it is mandatory to implement a modification of the Hue component),
up to 3 bonus pts for a creative solution, color palette aesthetics, or particular elegance of the solution.

Project

Visual Studio project: 115colormandala

Source file

Modify and hand in only the file : Colormap.cs
Returen your name in the function Colormap.InitParams()!


Copyright (C) 2018 J. Pelikán and J. Křivánek , last change: 2019-05-09 17:52:59 +0200 (Thu, 09 May 2019)