title: New Symbolic Color in Pango Span Text
body: <p>First time poster; long time admirer of the Stack Overflow angels.</p>
  
  <p>I'm having an issue with colors in span text that are controlled by Pango.</p>
  
  <p><b>Long Version:</b><br>
  I'm updating an old UI program which has C++ code guts with GTK, XML (written by Glade), and an RC stylesheet handling the graphics. Some of our colored markup text is hard-coded in the XML. Some of it is dynamically set in the C++ code.
  The problem is, that when the program runs on our older systems, the color referenced by span text as 'green' shows up as #00FF00. On our newer systems, 'green' is showing up as #008000.
  Example of code printing to a label widget:</p>
  
  <pre><code>    gtk_label_set_markup((GtkLabel *) TitleBarLabel, "&lt;span color='green'&gt;Orbital Cannon Positioning&lt;/span&gt;");
  </code></pre>
  
  <p>I'm fairly certain that Pango is in control of the span text markup. I found that the difference between the greens is exactly the difference between X11 and W3C color lists (<a href="https://en.wikipedia.org/wiki/X11_color_names#Clashes_between_web_and_X11_colors" rel="nofollow">https://en.wikipedia.org/wiki/X11_color_names#Clashes_between_web_and_X11_colors</a>).
  It seems that our old systems are using X11 and our new ones are using W3C, which makes sense.</p>
  
  <hr>
  
  <p>I could just replace all instances of 'green' with '#00FF00' but if we wanted to change the colors in the future, we'd have to go through the whole thing again. I'd much rather have the colors changeable through a stylesheet instead of baked into the code.</p>
  
  <p>C++ Code:</p>
  
  <pre><code>    GtkWidget * TitleBarLabel;
      TitleBarLabel = GTK_WIDGET (get_builder_object (builder, "TitleBarLabel"));
      gtk_label_set_markup((GtkLabel *) TitleBarLabel, "&lt;span color='#00FF00'&gt;Death Ray Power Status&lt;/span&gt;");
  </code></pre>
  
  <hr> 
  
  <p>I can create a GdkColor at run-time and gdk_color_parse it with values from a config file, and then use gtk_widget_modify_text() to apply the color to the label widgets. But then that doesn't work for all of the hard-coded span text in the XML. Also, we have pleanty of labels with bits of text colored differently inside the same line.</p>
  
  <p>C++ Code:</p>
  
  <pre><code>    GdkColor  pass_color;
      gdk_color_parse("#00FF00", &amp;pass_color);
  
      gtk_widget_modify_text(TitleBarLabel, GTK_STATE_NORMAL, &amp;pass_color);
  </code></pre>
  
  <hr>
  
  <p>I can make a style in my RC file for each color and link every single label that would use that color at run-time. But we'd have to remove all markup coloring and add lots of code for grabbing widgets that we never bothered with before and code for setting names of widgets instead of just printing to them with new span text. It gets the desired result of having the colors changeable in a stylesheet but it's a massive undertaking and it's not intuitive for our veteran engineers who are used to using the color attributes.</p>
  
  <p>RC File:</p>
  
  <pre><code>    style "pass_color"
      {
         fg[NORMAL] = #00FF00
      }
      widget "*TitleBarLabel_Pass" style "pass_color"
  </code></pre>
  
  <p>C++ Code:</p>
  
  <pre><code>    gtk_widget_set_name(TitleBarLabel, "TitleBarLabel_Pass");
  </code></pre>
  
  <hr>
  
  <p><b>Short Version:</b><br>
  Ideally, I would like to be able to make a new color at run-time that we can link with span text in such faction:</p>
  
  <pre><code>    &lt;span color='MyNewColor'&gt;Weather Manipulation Settings&lt;/span&gt;
  </code></pre>
  
  <p>Or maybe even create a new tag that applies specific attributes, like:</p>
  
  <pre><code>    &lt;span&gt;&lt;MyNewColor&gt;Shark Tank pH Balance&lt;/MyNewColor&gt;&lt;/span&gt;
  </code></pre>
  
  <p>But I doubt that's possible.</p>
  
  <p>I tried playing around with pango_attr_type_register(), pango_attr_foreground_new(), and friends, but I couldn't figure out how attributes work of if they could even do what I thought they did. After much research, it looks like an 'attribute' is just a one-time setting on a single string of text. And not a new value that can be called in line with span text, as I hoped.</p>
  
  <p>Is anything like this remotely possible without rebuilding all of Pango?<br>
  Is there a different work around that would get me a stylesheet like setup?<br>
  At this point, I'm open to suggestions.  </p>
  
  <p>Version Specs:<br>
  Computers showing green as #00FF00<br>
  OS: Linux Slackware 13.37 and below<br>
  GTK: 2.24.4<br>
  Pango: 1.28.4  </p>
  
  <p>Computers showing green as #008000<br>
  OS: Linux Slackware 14.1<br>
  GTK: 2.24.20<br>
  Pango: 1.34.1  </p>