# How to have a unique color for every unique id in Timelion?

**URL:** https://discuss.elastic.co/t/how-to-have-a-unique-color-for-every-unique-id-in-timelion/192333
**Category:** Kibana
**Tags:** timelion
**Created:** [July 25, 2019, 11:19pm UTC](https://discuss.elastic.co/t/how-to-have-a-unique-color-for-every-unique-id-in-timelion/192333 "2019-07-25T23:19:28Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![EZprogramming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ezprogramming/32/57291_2.png) [@EZprogramming](https://discuss.elastic.co/u/EZprogramming)
#### Post date: [July 25, 2019, 11:19pm UTC](https://discuss.elastic.co/t/how-to-have-a-unique-color-for-every-unique-id-in-timelion/192333/1 "2019-07-25T23:19:28Z")

</div>

_How can I have one color per unique `machine_id`?_ In the below graph I have two machine Ids listed on the top right hand side, but I would like to have different colors for each instead of them being all green.

**Here is my code:**

```
`.es(index=stage-athena-aux*, metric=avg:hours_per_device, timefield=capture_local_date, split=machine_id.keyword:2).color(green).title('Hours of operation').label(regex='.* machine_id.keyword:(.*) > .*', label='$1').bars(width=11).legend(ne)`

```

**and here is my graph:**

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/b/2ba6d878f2971f429ad519569987f2124333f312.png)

---

<div class="post-metadata">

### Author: ![EZprogramming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ezprogramming/32/57291_2.png) [@EZprogramming](https://discuss.elastic.co/u/EZprogramming)
#### Post date: [July 26, 2019, 4:26pm UTC](https://discuss.elastic.co/t/how-to-have-a-unique-color-for-every-unique-id-in-timelion/192333/2 "2019-07-26T16:26:07Z")

</div>

Bump

---

<div class="post-metadata">

### Author: ![Catherine\_Liu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/catherine_liu/32/34294_2.png) [@Catherine\_Liu](https://discuss.elastic.co/u/Catherine_Liu)
#### Post date: [July 26, 2019, 7:39pm UTC](https://discuss.elastic.co/t/how-to-have-a-unique-color-for-every-unique-id-in-timelion/192333/3 "2019-07-26T19:39:07Z")

</div>

@EZprogramming If you remove the `.color(green)` from your Timelion query , Timelion will automatically assign a different color per ID.

You can also provide multiple colors in a list separated by `:`'s to the `color` function, like this: `.color("red:green:blue:yellow:#4a790b")` to provide the chart with a color palette, and Timelion will assign a different color to each series, assuming you provided enough colors.

---

<div class="post-metadata">

### Author: ![EZprogramming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ezprogramming/32/57291_2.png) [@EZprogramming](https://discuss.elastic.co/u/EZprogramming)
#### Post date: [July 29, 2019, 1:47am UTC](https://discuss.elastic.co/t/how-to-have-a-unique-color-for-every-unique-id-in-timelion/192333/4 "2019-07-29T01:47:19Z")

</div>

Thanks a lot, that is the solution 🙂

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 26, 2019, 1:47am UTC](https://discuss.elastic.co/t/how-to-have-a-unique-color-for-every-unique-id-in-timelion/192333/5 "2019-08-26T01:47:21Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
