Jump to content

Documentation/DonutPie

From The Document Foundation Wiki

Color Wheel

This article explains several ways to create the geometry of a color wheel.

What is a color wheel?

A color wheel is defined here as a circle or ring in which colors are represented as an ordering system.
See Wikipedia

Sometimes the colors are displayed continuously, but typically a color wheel consists of 6, 7, 12, or 24 equal-sized sectors. The sectors are typically not used completely, but only as an arc, so that the color wheel has a circular hole in the middle. This variant of a Pie shape is called a Donut.

Colors in a Color Wheel

There are several proposals as to which colors should be included in a color wheel. Designers and scientists are still debating these suggestions.

Ultimately, you decide which colors to use depending on the intended use of the color wheel.

LibreOffice offers various tools for assigning a fill color to a shape:

  • Select the shape and use Area ▸ Color via context menu of the shape.
  • Select the shape and use Format ▸ Area ▸ Color.
  • Select the shape and open the Area tab in the sidebar under Properties. Under Fill/Color, select the desired color.
  • Open the Color Bar tool via View ▸ Color Bar. Drag a color onto the shape or select the shape and click on a color in the color bar.

To define or change a color, or to examine a color, use the Pick a Color dialog - see section Creating custom colors using Pick a Color dialog in the Draw Guide.

Variant 1 - Color Wheel only with Calc

We are going to use the variant Donut of Pie chart. To get sectors with the same angles, use the same values for all of the data cells. That value itself is arbitrary.

The category letters in column A let you identify the sector more easily. You can switch them on or off later.

A B C
1 Sector-ID Dummy Value
2 A 5
3 B 5
4 C 5
5 D 5
6 E 5
7 F 5
8 G 5
9

Do not start the Chart Wizard yet - we need to make a few more preparations first.

We want to define the colors of the sectors in the table without switching to the chart editing mode. To do this, we add a column with internal color values. This column will then be used for the Fill Color role of the data series.

A B C D E F G
1 Sector-ID Dummy Value Fill Color R G B
2 A 5 =COLOR(D2;E2;F2) 255 0 0
3 B 5 =COLOR(D3;E3;F3) 255 255 0
4 C 5 =COLOR(D4;E4;F4) 0 255 0
5 D 5 =COLOR(D5;E5;F5) 0 255 255
6 E 5 =COLOR(D6;E6;F6) 0 0 255
7 F 5 =COLOR(D7;E7;F7) 255 0 255
8

We do not enter the internal color values directly, but use the COLOR function to generate these values. The COLOR function has parameters for the color components Red, Green, and Blue and calculates the internal color value taking into account the current operating system. The values of a color component range from 0 to 255. You have probably seen such values before in a color picker.

Creating internal color values using the COLOR function
Creating internal color values using the COLOR function

Now mark columns A and B and insert the chart using the Chart Wizard.

In step Chart Type choose item Pie in variant Donut. Continue with the next step.

Step 'Chart Type' of chart wizard

The wizard should have recognized that the first row and the first column are labels. Therefore, continue with the next step.

In the Data Series step, select the Fill Color entry in the Data Ranges section and then go into the field in the Range for Fill Color section. The field has a minimize icon, but it does not work well because the chart obscures the required cell range. Enter the value manually instead. In the example used here, you need $Sheet1.$C$2:$C$7. Continue with the next step.

Chart wizard step 3, setting a data range for fill color
Chart wizard step 3, setting a data range for fill color

In Chart Elements step, deselect Display legend option. A legend is not appropriate here. Click Finish.

Resize the chart and drag it to a position, that does not cover the color values.

It is common for a color wheel to start with a sector at the top. To adjust the chart, switch to editing mode for the chart. You can double-click on the chart or use the item Edit of its context menu.

Select item Data Series from the Chart Elements drop-down list and open the properties for this element. In Options tab reduce or increase the start angle by half the sector angle. Click OK.

Dialog to set starting angle of pie chart
Dialog to set starting angle of pie chart

If you want to display the category labels, use Insert ▸ Data Labels and check the Category option. To hide the labels, uncheck this option.

Exit editing mode. You can now change the color values for the Red, Green and Blue components. Perhaps you want darker colors for Cyan and Magenta? Enter smaller values in the table. Note that the colors of the sectors of the color wheel are adjusted without the need to switch to chart edit mode again.

Editing chart fill colors using data in the table
Editing chart fill colors using data in the table

A version with this variant can be found in this document:
2025-05-22 von Regina - Sektorfarben.ods

Determining a color based on its Red, Green and Blue components is not intuitive. The HSV color model is easier to understand - and you can use it as well. Create columns for Hue, Saturation and Value (=Brightness) and then add helper columns to convert these HSV values to Red, Green and Blue component. Conversion methods are described in the Wikipedia. The attached sample document follows the algorithm given in https://de.wikipedia.org/wiki/HSV-Farbraum#Umrechnung_HSV_in_RGB. The sample document provides you with a color wheel with twelve sectors.
File:Sector colors HSV.ods

You will probably want to use this color wheel as an image in text documents or presentations. If the sector labels were only used as an aid for creating the color wheel, you should turn off the labels before creating the image. To create an image you can do one of these:

  • Use the Export as Image item from the context menu to save an image of the chart including its background.
  • Copy the chart and paste it from the clipboard as a GDI image into Draw, Impress or Writer. Do not use Ctrl + V. That would insert it as OLE-object. Instead use the drop-down-list from the Insert icon of the toolbar. The pasted object includes the chart background.
  • Switch to edit mode of the chart, select item Chart, copy it with Ctrl + C to the clipboard and paste it with Ctrl + V where you need it. It will be inserted as a GDI image. This way, you only copy the color wheel, not the background.

Variant 2 - Color Wheel with Calc and Draw

In the solution presented here, Draw is used in addition to the Calc component.

To create an example with 12 sectors,

  1. Open Calc and enter the value 10 in each of the cells A1:A12.
    In principle, the value itself is not important, it is only important that all cells contain the same value.
  2. Select the cells and choose Insert ▸ Chart from the menu.
  3. In the "Chart Wizard" dialog, select chart type Pie with variant Donut.
  4. Click on the Finish button. The default settings are sufficient here.

You now have a representation of a Donut with 12 sectors and each sector with a default color of the Chart Palettes color palette.

Example result EinFarbkreisErstellen in Calc LO252.ods

In the next steps we are going to use the Draw module to exchange the colors to those needed for a color wheel.

Switch to chart edit mode and select Chart in the drop-down list or click on the ring so that one marker point per sector is visible.

Press Ctrl + C to copy the Donut to the clipboard.

Now open Draw and paste the Donut onto a blank sheet using Ctrl + V. This inserts the Donut as GDI Metafile.

Example result EinFarbkreisErstellen Draw LO252.odg

The marked Donut should now be rotated by 15 degrees, so that a sector is centered in relation to the vertical.

Table for the typical sector divisions
Number of sectors Angle-degree per sector 1/2 Angle-degree per sector
6 60 30
7 51.43 25.71
12 30 15
24 15 7.5


Now we change the colors. Right-click on the Donut and select Break from the context menu. You get a set of Bézier-curve shapes. Now you can change the color of each individual sector shape, See 'Page 2' in the illustration for a possible color wheel.

For use of the color wheel in Impress or Writer you should select all sectors together and group them.

Variant 3 - Color Wheel only with Draw

Circle Pie shape

Basic idea: draw a sector and duplicate it with simultaneous rotation. We use the "Circle Pie" shape from the "Basic Shapes" category. Compared to the sector shape from the "Legacy Circles and Ovals" toolbar, it has the advantage that the shape center is always the center of the underlying circle, regardless of the sector angle. Since we want to divide the circle into 12 sectors, we need a sector of 360°/12=30°.

Visually

To visually create a 30° sector, we first need a precise 30° angle. We create the legs of this angle using two straight lines that we rotate appropriately. We want the upper sector to be centered with respect to the vertical. Therefore, we use a straight line rotated by 75° and a second straight line rotated by 105°. So that we can position the sector shape precisely later on, we specify that the center of our color wheel, and thus the apex of the angle, should lie at the point (10cm|10cm).

30deg angle positioned vertically symmetric
30deg angle positioned vertically symmetric

Start with a horizontal line about 6 cm long. Tip: Hold down the Shift key while drawing. After drawing, “Horizontal line selected” will appear in the status bar. Now use the Position and Size dialog. Go to the Rotation dialog page and set the rotation angle to 75°. Click OK.

Next, position the line so that its lower point has the coordinates (10cm|10cm). Open the Position and Size dialog again and go to the Position and Size dialog page. In the Position section, first set the base point to the lower left position and then enter 10cm in both Position X and Position Y. Tip: Click in the other field again to ensure that the values are applied. Click OK.

Now do the same again for the second leg. However, this time use a rotation angle of 105° and set the bottom right position as the base point for positioning.

You should have received an angle as shown in the illustration.

Now draw a Circle Pie shape. This can be found in the Basic Shapes category. The shape should be 8cm wide and 8cm high and its center should be at the point (10cm|10cm). This is the apex of the angle you have just constructed. Use the Position and Size dialog to achieve these values exactly. In this way, the color wheel will have an outer diameter of 8 cm.

30deg sector with circle diameter 8cm
30deg sector with circle diameter 8cm

The next step is to set the angle of the sector. To do this, drag the handles so that they lie exactly on the corresponding line. This only looks good at first glance if you have worked at a zoom setting of 100%. We need it to be more precise. Switch off all snap options, e.g. via the menu View ▸ Snap Guides. Enlarge the area around a handle to 3000%, e.g. using the Zoom & Pan tool. Correct the position of the handle. Then correct the position of the second handle in the same way.

Tip: You can traverse all points of a selected shape by repeatedly pressing Ctrl + Tab ↹. When you are at an active handle, you can move it pixel-by-pixel with the Alt + arrow key.

The sector is completed and can be duplicated. You can now delete the auxiliary angle lines as they are no longer needed.

Numerically

Unfortunately, it is not possible to specify the handle position numerically in the user interface. The “Position and Size” dialog has the “Control Point 1” and “Control Point 2” sections on the “Slant & Corner Radius” tab, but these are designed for XY-handles. However, the “Sector” shape has polar-handles. Currently, it is only possible to specify the handle positions numerically by writing the values directly into the markup of the file or by using a macro. The angles are located in the “draw:modifiers” attribute in the markup of the content.xml file.

Duplicate

Mark the sector. Go to menu Edit ▸ Duplicate. You need 11 copies. In section "Placement" set x axis and y axis to 0cm and Angle to 30°.

Variant

If you want a ring and not a full circle, draw a circle with suitable width and height and the background color as fill. Position it in the center of the sectors. In the example its center needs to be point (10cm|10cm).

Example files

The zip file contains an ODG with the color wheel and a quick guide, as well as an ODT file as a guide:
252DE EinFarbkreisErstellen.zip

Block Arc shape

Insert a Block Arc shape from the Basic Shapes category. While you drag-create the shape, hold the ⇧ Shift key pressed. That way the underlying ellipse becomes a circle. Drag it to 10cm width and height. You can see the size in the status bar. This will become the outer diameter of the color wheel. This size refers to the entire shape, i.e. where the white handles are, not to the arc. Thus the color wheel will have a 5cm radius.

If that does not work for you, insert the shape, select the shape and open the "Position and Size" dialog. You can do this using the Position and Size entry from the context menu of the shape, or menu Format ▸ Position and Size, or the F4 function key, or the icon in the toolbar. On the Position and Size dialog page, set the width and height of the shape to 10cm. Click OK.

The shape has a handle that allows you to adjust center angle and thickness of the arc. We want to create a color wheel with 12 sectors and an inner radius of 3 cm. Therefore, drag the handle to a position with a center angle of about 30° and an arc thickness of about 2 cm. Did you notice that the arc remains symmetrical to the vertical center line of the shape?

This handle is an XY handle and can therefore be adjusted numerically in the “Position and Size” dialog. We use the dialog now to set the shape to exactly 30° angle and exactly 3cm inner radius.

Select the shape and open the "Position and Size" dialog again. Switch to the Slant & Corner Radius dialog page. It has a Control Point 1 section to enter the coordinates of the handle position. The coordinates are measured relative to the top left corner of the shape. We need a little bit of mathematics to calculate the needed values.

The illustrations show that the handle requires the following coordinates:
x = 5cm−3cm∙sin(15°) ≈ 4.22cm
y = 5cm−3cm∙cos(15°) ≈ 2.10cm
Enter these values in the dialog. Click OK

You can then duplicate the arc in the same way as described for the Circle Pie shape.

Set in Circle (perspective) tool

Before you use this tool for creating a color wheel, make sure you are familiar with this tool. Find a description more detailed than help or guide books in article Special:MyLanguage/Documentation/Set_in_circle_perspective.

We are going to create a color wheel with outer radius 5cm, inner radius 3cm and 12 sectors. The Set in Circle (perspective) tool does not allow to create a full circle. Thus we create two half circles.

Create a rectangle with 1cm width and 2cm height and position its top left corner at coordinates (0cm|0cm). Use the Position and size dialog to set these values exactly.

Convert the shape into a Bézier curve, e.g. via Shape ▸ Convert ▸ To Curve.

Use the Edit ▸ Duplicate tool to create 11 additional shapes right from it. You need the Placement settings X axis=1cm, Y axis=0cm and Angle=0°. In the example, start and end color were set to make the shapes better distinguishable.

Row of 12 equal sized adjacent rectangular Bézier curves
Row of 12 equal sized adjacent rectangular Bézier curves

To make the construction accurate, place a snap point at the position (6cm|8cm). To create a snap point, right-click on an empty part of the page and use the item Insert Snap Guide. Make sure you see the snap guides, e.g. via View ▸ Snap Guides ▸ Display Snap Guides.

Make sure that only snap option Snap to Snap Guides is active, e.g. via View ▸ Snap Guides ▸ Snap to Snap Guides. It is helpful to increase the snap range to 25px to make the snap more visible. This setting can be found in Tools ▸ Options ▸ LibreOffice Draw ▸ Grid.

Now select the six rectangles on the right together.

Activate the Set to Circle (perspective) tool Icon crook rotate, e.g. via Shape ▸ Transformations ▸ Set to Circle (perspective)

Move the mouse to the bottom right handle of the selection. When the mouse pointer changes to the crook pointer crook mouse pointer, grab the handle and drag it to the snap point.

Distort the selection of the right six rectangles to the right half of the donut.
Distort the selection of the right six rectangles to the right half of the donut.

After it has snapped there, release the mouse button. You have got a half circle block arc.

Select the six rectangles on the left together. Again activate the Set to Circle (perspective) tool. Now drag the bottom left handle of the selection to the snap point.

Distort the selection of the left six rectangles to the left half of the donut.
Distort the selection of the left six rectangles to the left half of the donut.

You have got a full circle donut with 12 sectors. Now you can exchange the colors of the sectors to get the desired color wheel.

Crook result finished, ring with 12 sectors ready for creating color wheel
Crook result finished, ring with 12 sectors ready for creating color wheel

In contrast to a solution using the rotation of the Duplicate tool, no sector is rotated. They only look as if they are rotated. If you added text to a sector (e.g. the color name), the text would be upright.

Be careful: the sectors do not have a common center point and accidentally moving a sector is difficult to fix. In such a case, immediately clicking Undo can help.

Further Information

Work files

To Variant 1: 2025-05-22 von Regina - Sektorfarben.ods
To Variant 2: EinFarbkreisErstellen Draw LO252.odg
To Variant 3: 252DE EinFarbkreisErstellen.zip

Documentation / Manuals

Here you will find the documentation and manuals:

Documentation / Manuals

Any questions?

For questions on this topic go to:

Ask.LibreOffice

Get Involved

Join us today and help us to make it even better!

Get Involved

LibreOffice is Free Software and is made available free of charge.

Your donation, which is purely optional, supports our worldwide community.

If you like the software, please consider a Donation.