CRAN_status Downloads

unikn unikn::

Enabling elements of the University of Konstanz’s corporate design in R.

The unikn package provides color functions — by defining dedicated colors and color palettes, and commands for changing, viewing, and using them — and styled text elements (e.g., for marking, underlining, or plotting colored titles). The pre-defined range of colors and text functions is based on the corporate design of the University of Konstanz (see this link for details), but can be adapted and extended for other institutions and purposes.


Many institutions devise corporate design (CD) manuals to create and maintain a consistent impression in presentations and publications. For instance, the University of Konstanz introduced a highly recognizable corporate design in 2014. Its key component is the consistent use of a Seeblau color and a corresponding color palette that blends various shades of Seeblau (in boxes, lines, and other graphical elements) with text (in black-and-white). (See the corporate design pages and the Corporate Design Manual (pdf) for details.)

The unikn package aims to facilitate the use of corporate design elements for users of R. While the correct use of default specifications should be simple and straightforward, we leave some flexibility for more experienced users (e.g., for creating scientific visualizations).

The package currently provides 4 types of objects or functions:

  1. Dedicated colors and color palettes;
  2. Functions for viewing and changing color palettes (e.g., seecol() and usecol());
  3. Functions for plotting graphical objects (e.g., boxes and frames);
  4. Functions for plotting styled text elements (e.g., highlighting and underlining text).

Additional elements are added as they become available. Please use responsibly!


The current release of unikn is available from CRAN at

install.packages('unikn')  # install unikn from CRAN client
library('unikn')           # load to use the package

The current development version can be installed from its GitHub repository at

# install.packages('devtools')  # (if not installed yet)
library('unikn')  # load to use the package


A distinctive and recognizable color scheme is the most obvious element of the University of Konstanz’s corporate design.

Basic color palettes

Basic color palettes are specified according to the Corporate Design Manual (pdf):

The default color palette pal_unikn combines:

This yields a diverging, symmetrical default color palette pal_unikn consisting of 11 colors:

# Default color palette: ----- 
# pal_unikn  # 11 default colors

# View color palette (by plotting it): ----- 

Evaluating seecol(pal = "unikn_basic") shows these 3 basic unikn color palettes.

All color palettes

Beyond the 3 variants of pal_unikn, the unikn package provides the following color palettes:


Specifically, an Excel file called Colours for complex graphics defines 9 additional color palettes that are exported by unikn as the following named color palettes:

# Show 9 color gradient palettes:
seecol(pal = "grad_all")

For details, evaluate or apply seecol() on the following color palettes:

# 8 mono-tone palettes: ----- 
# Name:          Nr:           Tone:          
pal_seeblau      # 5 shades of seeblau
pal_peach        # 5           peach
pal_grau         # 5           grau
pal_petrol       # 5           petrol
pal_seegruen     # 5           seegruen 
pal_karpfenblau  # 5           karpfenblau
pal_pinky        # 5           pink
pal_Bordeaux     # 5           Bordeaux

# 1 signal (Ampel) palette: ----- 
pal_signal       # 3           signal/Ampel

Each color palette contains a preferred color.[1] All preferred colors are contained in a corresponding color palette pal_unikn_pref:

# Using preferred colors: ----- 
pal_unikn_pref             # color palette of preferred colors
pal_unikn_pref[1]          # preferred (named) color 1
pal_unikn_pref[[1]]        # color value 1: #59C7EB"
pal_unikn_pref["Seeblau"]  # preferred color by name

Additional pre-defined color palettes include:

# Plot additional color palettes: ----- 
seecol(pal_unikn_pref)   # palette of  9 preferred colors
seecol(pal_unikn_light)  # palette of  8 light colors (in 4 pairs)
seecol(pal_unikn_dark)   # palette of  8 dark colors (in 4 pairs)
seecol(pal_unikn_pair)   # palette of 16 paired colors (in 8 pairs)

More flexible and complex color palettes can be created by using the seecol() and usecol() functions.

The seecol() and usecol() functions provide a convenient interface for viewing and using color palettes.

Plotting color palettes

The seecol() function provides a quick overview over the contents of a color palette and allows comparisons between color palettes:

# Plot a color palette: ----- 
seecol(pal = pal_unikn_pref,            # palette to plot
       col_brd = "white", lwd_brd = 5)  # color and width of borders

Partial color palettes

When only a subset of a color palette are needed, the seecol() and usecol() functions provide a reasonable subset of a known ** unikn** color palette:

# All color palettes: ----- 
seecol(n = 4)

# Only pal_seeblau: ----- 
# seecol(pal_seeblau, n = 4)

Changing and creating color palettes

The usecol and seecol functions provide some generic options for manipulating and showing color gradients based on given colors or color palettes. This serves 2 main functions:

  1. Reducing or extending existing color palettes (to arbitrary lengths).
  2. Mixing and merging colors and color palettes into new color palettes.

Here are some examples of these functions in action:

seecol(pal_unikn, n = 21)  

# seecol(pal_seeblau, n = 8)  # provides a subset of "good" colors

Note that reducing an unikn color palette selects a suitable subset of its colors, rather than just truncating the scale.

# Combining color palettes (and colors): ----- 
seecol(c(rev(pal_petrol),  "white", pal_bordeaux), 11,
       col_bg = "grey90")

# Related combinations:
seecol(c(rev(pal_seeblau), "white", pal_pinky), 11)
seecol(c(rev(pal_seeblau), "white", pal_seegruen), 11)
seecol(c(rev(pal_seeblau), "white", pal_peach), 11)

Using color palettes

The unikn package exports the color palettes shown by seecol(pal = "all") and the 9 preferred colors of pal_unikn_pref (e.g., Seeblau, Seegruen, etc.) as named colors.

The usecol() function provides convenient access and additional options for using them in graphs. Here are some examples:

  1. Using unikn color palettes and functions in base R plots:

By default, simply set the color argument of a plot to usecol() with some unikn color palette:

# (a) Using a color palette:
barplot(1/sqrt(1:11),  col = usecol(pal_unikn))

Providing an additional value for n would reduce or extend the selected color palette and adding an opacity value for alpha (in the range [0, 1]) would regulate transparency.

  1. Visualizing unikn color palettes with image:
# Random images:
n <- 20
m <- matrix(rnorm(n*n), ncol = n, nrow = n)

# image(m, col = seecol(pal_seeblau))  # seecol() shows & use colors 
# image(m, col = usecol(pal_peach))    # usecol() only uses colors
# image(m, col = usecol(pal_seegruen))
# image(m, col = usecol(pal_petrol))
image(m, col = usecol(pal_seeblau, n = 50), 
      main = "50 shades of Seeblau", axes = FALSE)

  1. Using unikn in ggplot calls (using ggplot2):
# Example based on 

# (1) Create data: ---- 
ngroup <- 50
names <- paste("G_", seq(1, ngroup), sep = "")
df <- data.frame()

for(i in seq(1:30)){
    data = data.frame(matrix(0, ngroup, 3))
    data[, 1] = i
    data[, 2] = sample(names, nrow(data))
    data[, 3] = prop.table(sample( c(rep(0, 100), c(1:ngroup)), nrow(data)))
    df = rbind(df, data)}
colnames(df) <- c("X","group","Y")
df <- df[order(df$X, df$group) , ]

# (1) Choose colors: ---- 

# (a) using RColorBrewer: 
cur_col <- brewer.pal(11, "Paired") 
cur_col <- colorRampPalette(cur_col)(ngroup)
cur_col <- cur_col[sample(c(1:length(cur_col)), size = length(cur_col))]  # randomize

# (b) using unikn:
cur_col <- usecol(pal = pal_unikn, n = ngroup)
# cur_col <- cur_col[sample(c(1:length(cur_col)), size = length(cur_col))]  # randomize

# (3) Use ggplot2: ---- 
ggplot(df, aes(x = X, y = Y, fill = group)) + 
  geom_area(alpha = 1, color = Grau, size = .01 ) +
  theme_bw() + 
  scale_fill_manual(values = cur_col) +
  theme_void() +
  theme(legend.position = "none")

Using pal_unikn in ggplot

Generalization to other institutions

The color scales included in the unikn package are based on the CD manual of the University of Konstanz, Germany. However, the functionality provided by the package makes it easy and straightforward to define and use your own color schemes. Here are some examples from other institutions to illustrate how this can be achieved.

A. University of Freiburg, Germany:

Uni Freiburg

The Albert-Ludwigs Universität Freiburg provides fairly extensive information on its corporate color scheme (available here and here). Colors can be defined in a variety of ways, but R comes with convenient tools (like col2rgb and convertColor in grDevices) to handle most cases. The most straightforward way of creating a new color palette in R is by using its HEX/HTML code (provided in character format). As the University of Freiburg kindly provides their colors in this format, we can easily define the corresponding color palettes as named vectors:

# Basic colors:

pal_freiburg_bluered <- c("#004a99", "#c1002a")
names(pal_freiburg_bluered) <- c("uni-blau", "uni-rot")

pal_freiburg_basic <- c("#004a99", "white", "#c1002a")  # add "white" for better gradients
names(pal_freiburg_basic) <- c("uni-blau", "weiss", "uni-rot")

# Web colors:  

pal_freiburg_blue <- c("#004a99", "#2a6ebb", "#6f9ad3")
names(pal_freiburg_blue) <- c("blue-1", "blue-2", "blue-3")

pal_freiburg_grey <- c("#f2f3f1", "#e0e1dd", "#d5d6d2", "#c9cac8", 
                       "#b2b4b3", "#9a9b9c", "#747678", "#363534")
names(pal_freiburg_grey) <- c("grey-0", "grey-1", "grey-2", "grey-3", 
                              "grey-5", "grey-7", "grey-9", "grey-font")

# Info colors: 
pal_freiburg_info <- c("#2a6ebb", "#a7c1e3", "#7b2927", "#de3831", "#739600", "#92d400", 
                       "#4d4f53", "#747678", "#b2b4b3", "#d5d6d2", "#e98300", "#efbd47")
names(pal_freiburg_info) <- c("mid-blau", "hell-blau", "dark-red", "hell-red", "mid-green", "hell-green", 
                              "anthrazit", "dark-grey", "mid-grey", "hell-grey", "orange", "gelb")

Alternatively, we can define both (colors and names) in 1 step by using the newpal() function:

pal_freiburg_info <- newpal(col = c("#2a6ebb", "#a7c1e3", "#7b2927", "#de3831", "#739600", "#92d400", 
                                    "#4d4f53", "#747678", "#b2b4b3", "#d5d6d2", "#e98300", "#efbd47"),
                            names = c("mid-blau", "hell-blau", "dark-red", "hell-red", "mid-green", "hell-green", 
                                      "anthrazit", "dark-grey", "mid-grey", "hell-grey", "orange", "gelb")
# seecol(pal_freiburg_info)

Once a new color palette has been defined (and is available in your current R environment), we can use the seecol() and usecol() functions to view, modify, and use the palette:

seecol(pal_freiburg_info)            # view color palette

# seecol(pal_freiburg_basic, n = 7)  # extend color palette
# seecol(c(pal_freiburg_blue, "white", pal_freiburg_grey))  # mix color palette

B. Princeton University, USA:

Princeton University

The color scheme of Princeton University is easily recognized by its combination of orange with black and white elements. The official guidelines (available here) define “Princeton Orange” as Pantone (PMS) 158 C.

These definitions suggest defining 3 separate versions of orange and corresponding color palettes:

# HEX values for 3 shades of orange: 
orange_basic <- "#E87722"  # Pantone 158 C
orange_white <- "#E77500"  # orange on white
orange_black <- "#F58025"  # orange on black

# Defining color palettes:
pal_princeton <- c(orange_basic, "black")
names(pal_princeton) <- c("orange", "black")

pal_princeton_1 <- c(orange_white, "white", "black")
names(pal_princeton_1) <- c("orange_w", "white", "black")

pal_princeton_2 <- c(pal = c(orange_black, "black", "white"))
names(pal_princeton_2) <- c("orange_b", "black", "white")

Alternatively, we can define both (colors and names) in 1 step by using the newpal() function:

pal_princeton_1 <- newpal(col = c("#E77500", "white", "black"),
                          names = c("orange_w", "white", "black")
# seecol(pal_princeton_1)

The new color palettes (e.g., pal_princeton_1) can now be viewed with seecol(), scaled by usecol(), and used in graphs (e.g., in ggplot commands):

# View color palette: 
# seecol(pal_princeton_1)  

# Scale color palette (using df and ngroup from above):
my_pal <- usecol(pal = pal_princeton_1, n = ngroup)

# Use my_pal for plotting: 
ggplot(df, aes(x = X, y = Y, fill = group)) + 
  geom_area(alpha = 1, color = Grau, size = .01 ) +
  theme_bw() + 
  scale_fill_manual(values = my_pal) +
  theme_void() +
  theme(legend.position = "none")


C. Max Planck Society, Germany:


The CD manual (available here) of the Max Planck Society specifies the use of 2 primary colors:

Again, the easiest way of defining a corresponding color palette is by creating a named vector. To allow for better color gradients, we insert the color "white" between the 2 dedicated colors:

pal_mpg <- c("#007367", "white", "#D0D3D4")
names(pal_mpg) <- c("mpg green", "white", "mpg grey")

Alternatively, we can define both (colors and names) in 1 step by using the newpal() function:

pal_mpg <- newpal(col = c("#007367", "white", "#D0D3D4"),
                  names = c("mpg green", "white", "mpg grey")
# seecol(pal_mpg)

As before, can now use the seecol() and usecol() functions to view, modify, and use the new pal_mpg color palette:

# View color palette: 
# seecol(pal_mpg)

# Use pal_mpg in image:
x <- y <- seq(-4 * pi, 4 * pi, len = 15)
r <- sqrt(outer(x^2, y^2, "+"))
image(z = cos(r^2) * exp(-r/6), col = usecol(pal_mpg, n = 10), 
      main = "Shades of MPG (using pal_mpg)", axes = FALSE)

Comparing color palettes

Once a new palette is defined (and available in your current R environment), the seecol() and usecol() functions allow comparing, scaling, and using them in the same fashion as the native unikn color palettes:

# Compare and extend custom color palettes:
# seecol(list(pal_freiburg_info, pal_freiburg_basic, pal_mpg, pal_princeton_1)) # compare basic versions
seecol(list(pal_freiburg_basic, pal_princeton_1, pal_mpg, pal_unikn), n = 9)    # compare scaled versions

Text decorations

Beyond color functions, unikn also provides some functions for plotting graphical elements (like boxes) and styled text (with decorations like colored backgrounds or underlining). By default, the text-decoration functions assume that you want to add styled text to an existing plot, unless the new_plot argument specifies a type of plot to be generated. As the use of these functions is explained in detail in vignette("Text"), we only provide some examples here:


The mark() function allows emphasizing text by plotting it with colored background (to provide the functionality of “Markieren”):

mark(labels = c("Markieren", "ist ein Bestandteil", "von Studieren."), 
     x = 0, y = .8, y_layout = .03, cex = 1.5, new_plot = "slide")


The uline() function allows emphasizing text by plotting it with colored underlining (to provide the functionality of “Unterstreichen”):

uline(labels = c("Geradlinig", "Authentisch", "Beweglich", "Offen", "Paradiesisch"), 
      x = .05, y = .9, y_layout = "even", cex = 1.1, font = 2, new_plot = "slide")


The post() function allows adding text to a rectangular xbox (to provide the functionality of “Merken”):

xbox(col = usecol(pal_seeblau[[5]]), dim = c(2, 2))
post(labels = c("Für eine", "Kultur der", "Kreativität"), x = .1, y = .8, cex = 1.4, font = 2)

The color and font parameters can be adjusted to obtain different looks:

post(labels = c("creative.", "together"), new_plot = "xbox", 
     y_layout = .02, cex = 2, font = c(1, 3),  
     col_bg = pal_seegruen[[1]], col = c(Petrol, Pinky))


The heading() function is a convenient wrapper around mark:

heading(labels = c("pa-", "ra-", "die-", "sisch"))

Headings violating the official recommendations (e.g., step-wise titles) will generate a message.


Finally, the url_unikn() function allows formatting URLs the way:

my_url <- url_unikn("")  # input URL as copied from web browser

post(labels = my_url, x = .2, y = .1, font = 4, new_plot = "xbox")

Other institutions

If custom color palettes are available (see definitions above), the text decoration functions can be used for graphical annotations in the style of other institutions:

# (A) Using pal_freiburg_basic and pal_freiburg_blue: 
uline(labels = c("University of Freiburg"), 
      x = .6, y = .85, font = 2, cex = 1, 
      col = pal_freiburg_basic[[1]], col_bg = pal_freiburg_basic[[3]], 
      new_plot = "slide")
mark(labels = c("Die Wahrheit", "wird euch", "frei machen."), 
     x = 0, y = .90, y_layout = 0, cex = 1.5, 
     col = c("white"), col_bg = rev(usecol(pal_freiburg_blue, 3)))

# (B) Using orange_white or pal_princeton:
uline(labels = c("Princeton University"), 
      x = .6, y = .55, font = 2, cex = 1, col_bg = orange_white)
mark(labels = c("Go", "tigers!"), 
     x = 0, y = .58, y_layout = 0, cex = 2.0,  
     col = c("black", "white"), col_bg = pal_princeton)

# (C) Using pal_mpg:
uline(labels = c("Max Planck Society"), 
      x = .6, y = .25, font = 2, cex = 1, col_bg = usecol(pal_mpg, 1), col = "black")
mark(labels = c("Dem Anwenden", "muss das Erkennen", "vorausgehen."), 
     x = 0, y = .30, y_layout = 0, cex = 1.5, 
     col = c("white"), col_bg = usecol(pal_mpg, 7)[3:1])


Please note the following caveats:

Overall, we hope that the following functions will be useful for plotting graphical elements (e.g., boxes, logos, etc.) and achieving a uniform look when styling visualizations.



The unikn package is work in progress. We are still working on:

Please contact us in case you need additional features or want to help us implementing them.


The following versions of unikn and corresponding resources are currently available:

Type: Version: URL:
A. unikn (R package): Release version
  Development version
B. Online documentation: Release version
  Development version


Please report any unikn-related issues at We appreciate your feedback, comments, or questions.


The University of Konstanz’s Corporate Design (CD) was created by the University of Konstanz and Strichpunkt GmbH and introduced in 2014. We are members of the research group on Social Psychology and Decision Sciences at the University of Konstanz and make some CD elements available to fellow users of R (e.g., for creating scientific visualizations). However, all copyrights on the CD remain with the original copyright holders.

We aim for an authentic representation of a highly-specified corporate design. While rigid specifications help to maintain coherence and consistency, they also tend to cause frustration in expert users. As the design has been developed in a flexible way that allows for individual elements to be modified as needed, we allow for some liberties, mostly by relaxing some restrictions. Examples include:



Creative Commons License

unikn by Hansjörg Neth and Nico Gradwohl is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. (Based on a work at


The copyrights to all designs remain with their original creators:

Color definitions are based on the specifications at:

[Updated on 2019-09-25.]

[1] Whereas the official definition does not identify a preferred color for the Ampel color palette (pal_signal), we provide its alert color (i.e., pal_signal[2]) as a designated color Signal.