# Makie and colours

**URL:** https://discourse.julialang.org/t/makie-and-colours/21937
**Category:** Visualization
**Tags:** makie, polyhedra
**Created:** [March 16, 2019, 10:21am UTC](https://discourse.julialang.org/t/makie-and-colours/21937 "2019-03-16T10:21:22Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![fa-bien](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fa-bien/32/5559_2.png) [@fa-bien](https://discourse.julialang.org/u/fa-bien)
#### Post date: [March 16, 2019, 10:21am UTC](https://discourse.julialang.org/t/makie-and-colours/21937/1 "2019-03-16T10:21:22Z")

</div>

I am visualising polyhedra with Makie. However I find that colours are all way too dark, see MWE that displays a cube that should be the brightest shade of yellow, but is not very bright. Moreover, I find that it gets brighter if I use values above 1, e.g. RGB(4.0, 2.5, 0.0), even though ColorTypes.jl specifies that values should be between 0 and 1, so this is likely a bug. This also happens with RGBA and HSVA colours.

MWE:

```julia
using Makie
using Polyhedra
import ColorTypes: RGB

points = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1],
           [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1] ]

yellow = RGB(1.0, 1.0, 0.0)

cube = Polyhedra.Mesh(polyhedron(vrep(points)))

scene = mesh(cube, color=yellow)

```

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [March 16, 2019, 10:43am UTC](https://discourse.julialang.org/t/makie-and-colours/21937/2 "2019-03-16T10:43:41Z")

</div>

What happens if you use `RGB24`?

---

<div class="post-metadata">

### Author: ![fa-bien](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fa-bien/32/5559_2.png) [@fa-bien](https://discourse.julialang.org/u/fa-bien)
#### Post date: [March 16, 2019, 10:58am UTC](https://discourse.julialang.org/t/makie-and-colours/21937/3 "2019-03-16T10:58:26Z")

</div>

The result is the same with RGB24(1.0, 1.0, 0.0) if I understand the question right.

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [March 16, 2019, 11:04am UTC](https://discourse.julialang.org/t/makie-and-colours/21937/4 "2019-03-16T11:04:54Z")

</div>

Ok, I suggested it because that actually errors for values outside [0, 1]:

```julia
julia> RGB24(2.0, 1.0, 1.0)
ERROR: ArgumentError: element type FixedPointNumbers.Normed{UInt8,8} is an 8-bit type representing 256 values from 0.0 to 1.0,
  but the values (2.0, 1.0, 1.0) do not lie within this range.
  See the READMEs for FixedPointNumbers and ColorTypes for more information.

```

---

<div class="post-metadata">

### Author: ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)
#### Post date: [March 16, 2019, 11:05am UTC](https://discourse.julialang.org/t/makie-and-colours/21937/5 "2019-03-16T11:05:58Z")

</div>

> [@fa-bien](#):
>
> using Makie using Polyhedra import ColorTypes: RGB points = [[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1] ] yellow = RGB(1.0, 1.0, 0.0) cube = Polyhedra.Mesh(polyhedron(vrep(points))) scene = mesh(cube, color=yellow)

Try `scene = Makie.mesh(cube, color=yellow, shading=false)`.

---

<div class="post-metadata">

### Author: ![fa-bien](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fa-bien/32/5559_2.png) [@fa-bien](https://discourse.julialang.org/u/fa-bien)
#### Post date: [March 16, 2019, 1:42pm UTC](https://discourse.julialang.org/t/makie-and-colours/21937/6 "2019-03-16T13:42:09Z")

</div>

True, I missed that. What I meant was that RGB24(1.0, 1.0, 0.0) still leads to something that is far from a bright yellow.

---

<div class="post-metadata">

### Author: ![fa-bien](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fa-bien/32/5559_2.png) [@fa-bien](https://discourse.julialang.org/u/fa-bien)
#### Post date: [March 16, 2019, 1:46pm UTC](https://discourse.julialang.org/t/makie-and-colours/21937/7 "2019-03-16T13:46:47Z")

</div>

This works, thank you very much!
