Makie and colours

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:

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)

What happens if you use RGB24?

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

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

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.

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

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.

This works, thank you very much!

1 Like