Changing color programatically

I’m trying to calculate point locations by converting spherical coordinates to Cartesian coordinates by calculating the X,Y,Z coordinates and using add_line to connect them. I would like to have different colors for the different lines as they are computed, but I can’t figure out if there is any methods to change the color of the lines (edges?) being drawn by add_line.
Is this possible and is there any sample code showing the correct technique to call a function or method (or whatever) to change the current drawing color from inside my Ruby code?
Thanks

You create a material or use one that is ready in a library.
SketchUp comes with quite a number of material libraries, one of which is “Colors-Named”.

# Firstly, set the rendering options to edge color by material:
model = Sketchup.active_model
opts = model.rendering_options
opts["EdgeColorMode"]= 0

# If using scene pages then update the current scene's style:
if model.pages.size > 0
  page = model.pages.selected_page
  page.use_rendering_options= true
  page.style.update(2)
end

# Load a particular material into the model's materials collection:
matls = model.materials
matlpath = "Materials/Colors-Named/0019_Crimson.skm"
filepath = Sketchup.find_support_file(matlpath)
# The API's material load method raises an exception on failure:
begin
  matl = matls.load(filepath)
rescue RuntimeError = err
  matl = nil
end

# It's a good idea to check for failure which would be nil,
# which in Ruby evaluates falsely:
if matl && matl.valid?
  # Assign a material object as an entity's material property:
  edge.material= matl
end