Repository: fury-gl/fury

Issue:
Line Actor creates issue if not pass the colors
```
import numpy as np

from fury import actor, window

scene = window.Scene()
lines = [np.random.rand(10, 3) for _ in range(5)]
# colors = np.random.rand(5, 3)
line_actor = actor.line(lines=lines)
scene.add(line_actor)
show_manager = window.ShowManager(scene=scene, size=(600, 600))
show_manager.start()
```

Error: `ValueError: Color array size doesn't match either vertex count or segment count`

Discussion:
@m-agour: Solved in #983.

Solution patch:
diff --git a/fury/actor.py b/fury/actor.py
index 1a0bd6a71..615f3c2ec 100644
--- a/fury/actor.py
+++ b/fury/actor.py
@@ -157,8 +157,19 @@ def line(
         else np.empty_like(lines_positions),
     )
 
+    if lines_colors is None:
+        material_mode = "auto"
+        material_colors = None
+    else:
+        material_mode = "vertex"
+        material_colors = lines_colors
+
     mat = _create_line_material(
-        material=material, enable_picking=enable_picking, mode="auto", opacity=opacity
+        material=material,
+        enable_picking=enable_picking,
+        mode=material_mode,
+        opacity=opacity,
+        color=material_colors,
     )
 
     obj = create_line(geometry=geo, material=mat)
diff --git a/fury/geometry.py b/fury/geometry.py
index 43f1b2d5d..f76ca7c9c 100644
--- a/fury/geometry.py
+++ b/fury/geometry.py
@@ -129,6 +129,8 @@ def line_buffer_separator(line_vertices, color=None, color_mode="auto"):
                 color_mode = "vertex_flattened"
             elif len(color) == len(line_vertices):
                 color_mode = "vertex"
+            elif len(color) == 3 or len(color) == 4:
+                color = None
             else:
                 raise ValueError(
                     "Color array size doesn't match "


Test patch:
diff --git a/fury/tests/test_actor.py b/fury/tests/test_actor.py
index 94b9aa0ea..344c21b27 100644
--- a/fury/tests/test_actor.py
+++ b/fury/tests/test_actor.py
@@ -78,6 +78,17 @@ def test_line():
     colors = np.array([[[1, 0, 0]], [[0, 1, 0]]])
     validate_actors(lines=lines_points, colors=colors, actor_type="line", prim_count=2)
 
+    line = np.array([[0, 0, 0], [1, 1, 1]])
+    colors = None
+    validate_actors(lines=line, colors=colors, actor_type="line", prim_count=2)
+
+    line = np.array([[0, 0, 0], [1, 1, 1]])
+    actor.line(line, colors=colors)
+    actor.line(line)
+    actor.line(line, colors=colors)
+    actor.line(line, colors=colors, material="basic")
+    actor.line(line, colors=line, material="basic")
+
 
 def test_box():
     centers = np.array([[0, 0, 0]])
diff --git a/fury/tests/test_geometry.py b/fury/tests/test_geometry.py
index 00951226d..2038d2cd7 100644
--- a/fury/tests/test_geometry.py
+++ b/fury/tests/test_geometry.py
@@ -146,9 +146,9 @@ def test_line_buffer_separator():
         np.array([[0, 0, 0]], dtype=np.float32),
         np.array([[1, 1, 1]], dtype=np.float32),
     ]
-    color = np.array([1, 0, 0], dtype=np.float32)  # Invalid shape
-    with npt.assert_raises(ValueError):
-        geometry.line_buffer_separator(line_vertices, color=color, color_mode="auto")
+    color = np.array([1, 0, 0], dtype=np.float32)  # valid color now
+
+    geometry.line_buffer_separator(line_vertices, color=color, color_mode="auto")
 
     line_vertices = [np.array([[0, 0, 0], [1, 1, 1]], dtype=np.float32)]
     positions, colors = geometry.line_buffer_separator(line_vertices)