# Assign a random color to a new label

**URL:** <https://community.vikunja.io/t/assign-a-random-color-to-a-new-label/348>\
**Category:** Feature Discussion\
**Created:** [8 September 2021 09:40 UTC](https://community.vikunja.io/t/assign-a-random-color-to-a-new-label/348 "2021-09-08T09:40:51Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![dpschen](https://community.vikunja.io/letter_avatar_proxy/v4/letter/d/47e85d/32.png) [@dpschen](https://community.vikunja.io/u/dpschen)\
**Post date:** [30 September 2022 18:27 UTC](https://community.vikunja.io/t/assign-a-random-color-to-a-new-label/348/7 "2022-09-30T18:27:56Z")

</div>

I recently created random colors for charts where we didn’t know the amount of necessary colors.

It’s not easy but possible when you consider some color theory.

Helping is the [new way of WCAG3 for calculating color contrast APCA](https://git.apcacontrast.com/documentation/WhyAPCA.html) in combination with the [OKlch color model](https://bottosson.github.io/posts/oklab/) (see also the [color picker](https://oklch.evilmartians.io/#70,0.1,133,100)).

This can be visualised greatly with [huetone](https://huetone.ardov.me/)

I also found [d3-scale-chromatic](https://github.com/d3/d3-scale-chromatic) very interesting.

---

_[View the full topic](https://community.vikunja.io/t/assign-a-random-color-to-a-new-label/348)._
