Makie and colours

#1

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)
0 Likes

#2

What happens if you use RGB24?

0 Likes

#3

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

0 Likes

#4

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.
0 Likes

#5

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

0 Likes

#6

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.

0 Likes

#7

This works, thank you very much!

1 Like