<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#330000">
    On 05/04/2012 12:15, grivet wrote:
    <blockquote cite="mid:4F7D70A8.4050102@cnrs-orleans.fr" type="cite">
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
      Le 03/04/2012 19:27, Adrien Vogt-Schilb a écrit :
      <blockquote cite="mid:4F7B330C.40602@centre-cired.fr" type="cite">
        <meta content="text/html; charset=UTF-8"
          http-equiv="Content-Type">
        On 03/04/2012 17:47, grivet wrote:
        <blockquote cite="mid:4F7B1B87.30903@cnrs-orleans.fr"
          type="cite">
          <meta content="text/html; charset=UTF-8"
            http-equiv="Content-Type">
          <small>Hello,<br>
            How can I change the color of a string using Scilab5.3.2?<br>
            For instance, I wish to plot two vectors using
            plot2d(u,[a,b],style=[2,14]) and then write a<br>
            label next to each curve with xstring(xa,ya,string_a), </small><small>xstring(xb,yb,string_b);



            this works.<br>
            Now, I would like to match the color of the text to that of
            the curves. I tried xset("color",2)<br>
            and xset("color",14); this changes the color of the axes (in
            an unpredictable manner) but not <br>
            that of the text.<br>
            Thanks for your help<br>
            <br>
            <br>
          </small><small> </small> </blockquote>
        Hi<br>
        <br>
        Build on this:<br>
        <br>
        plot()<br>
        xstring(1,0,"ET PAF!")<br>
        e=gce()<br>
        e.font_foreground = 3<br>
        <br>
        or if you are familiar with <a moz-do-not-send="true"
          href="http://en.wikipedia.org/wiki/RGB_color_model">RGB</a>:<br>
        <br>
        e.font_foreground = color(255,100,100)<br>
        <br>
        br<br>
        avs<br>
      </blockquote>
      <font size="-1">Thank you Adrien, this works fine; is there a way
        to change the color of several strings at the same time<br>
        instead of repeating the sequence xstring(), e =
        gce(),e.font_foreground = n for each ?<br>
        JP Grivet<br>
      </font> </blockquote>
    Hi<br>
    <br>
    I'd build an upper-level function:<br>
    <br>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <div style="float: left; white-space: pre; line-height: 1;
      background: #FFFFFF; "><span class="sc0"></span><span class="sc8">myDEFAULT_color
        = color</span><span class="sc10">(</span><span class="sc4">155</span><span
        class="sc10">,</span><span class="sc4">120</span><span
        class="sc10">,</span><span class="sc4">60</span><span
        class="sc10">)</span><span class="sc0"></span><span class="sc0">;<br>
      </span><span class="sc12">function</span><span class="sc0"> </span><span
        class="sc11">mystring</span><span class="sc10">(</span><span
        class="sc11">x</span><span class="sc10">,</span><span
        class="sc11">y</span><span class="sc10">,</span><span
        class="sc11">str</span><span class="sc10">,</span><span
        class="sc11">mycolor</span><span class="sc10">)</span><span
        class="sc0">
      </span><span class="sc2">//plots str on x, y in color mycolor.
        mycolor is optional</span><span class="sc0"> </span><span
        class="sc2">//Default value for mycolor</span><span class="sc0">
      </span><span class="sc12">if</span><span class="sc0"> </span><span
        class="sc8">argn</span><span class="sc10">(</span><span
        class="sc4">2</span><span class="sc10">)<</span><span
        class="sc4">4</span><span class="sc0"> </span><span
        class="sc11">mycolor</span><span class="sc0"> </span><span
        class="sc10">=</span><span class="sc0"> </span><span
        class="sc8">myDEFAULT_color</span><span class="sc0"> </span><span
        class="sc13">end</span><span class="sc0"> </span><span
        class="sc8">xstring</span><span class="sc10">(</span><span
        class="sc11">x</span><span class="sc10">,</span><span
        class="sc11">y</span><span class="sc10">,</span><span
        class="sc11">str</span><span class="sc10">)</span><span
        class="sc0"> </span><span class="sc11">e</span><span
        class="sc10">=</span><span class="sc8">gce</span><span
        class="sc10">()</span><span class="sc0"> </span><span
        class="sc11">e</span><span class="sc10">.</span><span
        class="sc11">font_foreground</span><span class="sc0"> </span><span
        class="sc10">=</span><span class="sc0"> </span><span
        class="sc11">mycolor</span><span class="sc0">
      </span><span class="sc13">endfunction</span><span class="sc0">
        <br>
        <br>
        <br>
        then use mystring instead of xstring<br>
        note that you may omit the last argument<br>
        <br>
      </span></div>
    <title>Exported from Notepad++</title>
    <style type="text/css">
span {
        font-family: 'Courier New';
        font-size: 10pt;
        color: #000000;
}
.sc0 {
}
.sc2 {
        font-size: 8pt;
        color: #279860;
}
.sc4 {
        color: #EFA238;
}
.sc8 {
        font-style: italic;
}
.sc10 {
        color: #C600C6;
}
.sc11 {
}
.sc12 {
        color: #FF0000;
}
.sc13 {
        color: #FF0000;
}
</style><br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
  </body>
</html>