Get Color of Graph Trace In Variables

// This was posted by Rick Gerkin to the Igor mailing list. I added a demo function.

Function GetTraceColor(graph,trace,red,green,blue)
    String graph, trace
    Variable &red,&green,&blue

    String info = TraceInfo(graph,trace,0)
    String color=StringByKey("rgb(x)",info,"=")
    sscanf color,"(%d,%d,%d)",red,green,blue
End

Function DemoGetTraceColor()
    Make/O TraceColorDemoWave = sin(x/8)
   
    DoWindow TraceColorDemoGraph
    if (V_Flag == 0)
        Display /N=TraceColorDemoGraph TraceColorDemoWave
        ModifyGraph rgb(TraceColorDemoWave) = (50000, 40000, 30000)
    endif
   
    Variable red, green, blue
   
    GetTraceColor("TraceColorDemoGraph","TraceColorDemoWave",red,green,blue)
    Print red, green, blue
End


Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More