<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://agiwiki.sierrahelp.com//index.php?action=history&amp;feed=atom&amp;title=Set.text.attribute</id>
	<title>Set.text.attribute - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://agiwiki.sierrahelp.com//index.php?action=history&amp;feed=atom&amp;title=Set.text.attribute"/>
	<link rel="alternate" type="text/html" href="http://agiwiki.sierrahelp.com//index.php?title=Set.text.attribute&amp;action=history"/>
	<updated>2026-09-19T14:32:12Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.9</generator>
	<entry>
		<id>http://agiwiki.sierrahelp.com//index.php?title=Set.text.attribute&amp;diff=13097&amp;oldid=prev</id>
		<title>Andrew Korson: /* Remarks */</title>
		<link rel="alternate" type="text/html" href="http://agiwiki.sierrahelp.com//index.php?title=Set.text.attribute&amp;diff=13097&amp;oldid=prev"/>
		<updated>2019-04-22T01:53:17Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Remarks&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:53, 22 April 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l13&quot; &gt;Line 13:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;On the [[Hercules Graphics Card (HGC)]] display, there are only two colors available (black and white). When displaying text (on either screen) if the set foreground value is less than or equal to the set background value, AGI draws black text on a white background, otherwise it draws white text on  black background.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;On the [[Hercules Graphics Card (HGC)]] display, there are only two colors available (black and white). When displaying text (on either screen) if the set foreground value is less than or equal to the set background value, AGI draws black text on a white background, otherwise it draws white text on  black background.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The text screen on a Color Graphics Adapter (CGA) display supports sixteen colors, so it will show all combinations of background and foreground color just like Enhanced Graphics Adapter displays. On the graphics screen, CGA only has four colors, so AGI uses a table to choose foreground text colors when the background is black (if background is not black, foreground &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is always &lt;/del&gt;white, same as EGA displays):&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The text screen on a Color Graphics Adapter (CGA) display supports sixteen colors, so it will show all combinations of background and foreground color just like Enhanced Graphics Adapter displays. On the graphics screen, CGA only has four colors, so AGI uses a table to choose foreground text colors when the background is black (if background is not black, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;AGI uses black &lt;/ins&gt;foreground &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;on &lt;/ins&gt;white &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;background&lt;/ins&gt;, same as EGA displays):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key collectr_mwAGI-mw_:diff::1.12:old-13096:rev-13097 --&gt;
&lt;/table&gt;</summary>
		<author><name>Andrew Korson</name></author>
	</entry>
	<entry>
		<id>http://agiwiki.sierrahelp.com//index.php?title=Set.text.attribute&amp;diff=13096&amp;oldid=prev</id>
		<title>Andrew Korson: Created page with &quot;The &#039;&#039;&#039;set.text.attribute&#039;&#039;&#039; command sets the foreground and background color for the display commands.  == Syntax ==  set.text.attribute(byt FG, byt BG)...&quot;</title>
		<link rel="alternate" type="text/html" href="http://agiwiki.sierrahelp.com//index.php?title=Set.text.attribute&amp;diff=13096&amp;oldid=prev"/>
		<updated>2019-04-22T01:45:12Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;The &amp;#039;&amp;#039;&amp;#039;set.text.attribute&amp;#039;&amp;#039;&amp;#039; command sets the foreground and background color for the display commands.  == Syntax ==  set.text.attribute(&lt;a href=&quot;/index.php/Number&quot; title=&quot;Number&quot;&gt;byt&lt;/a&gt; FG, &lt;a href=&quot;/index.php/Number&quot; title=&quot;Number&quot;&gt;byt&lt;/a&gt; BG)...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The &amp;#039;&amp;#039;&amp;#039;set.text.attribute&amp;#039;&amp;#039;&amp;#039; command sets the foreground and background color for the display commands.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
set.text.attribute([[number|byt]] FG, [[number|byt]] BG);&lt;br /&gt;
&lt;br /&gt;
== Remarks ==&lt;br /&gt;
&lt;br /&gt;
This command sets the foreground and background [[colors]] used by AGI to display text with the &amp;#039;&amp;#039;&amp;#039;[[display]]&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;[[display.v]]&amp;#039;&amp;#039;&amp;#039; commands to &amp;#039;&amp;#039;&amp;#039;FG&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;BG&amp;#039;&amp;#039;&amp;#039; respectively. The [[input line]] also uses the foreground and background colors set by this command. The default foreground color is white, and the default background color is black for both the [[graphics screen]] and the [[text screen]].&lt;br /&gt;
&lt;br /&gt;
When the [[text screen]] is active, both the background color and the foreground color are displayed according to the values set by the &amp;#039;&amp;#039;&amp;#039;set.text.attribute&amp;#039;&amp;#039;&amp;#039; command. On the [[graphics]] screen, AGI limits the background color to black or white. If the background color is is black, AGI draws text using the set values for background and foreground. If the background color is any value other than black, AGI uses white as the background, and draws text with black foreground (ignoring the set foreground value).&lt;br /&gt;
&lt;br /&gt;
On the [[Hercules Graphics Card (HGC)]] display, there are only two colors available (black and white). When displaying text (on either screen) if the set foreground value is less than or equal to the set background value, AGI draws black text on a white background, otherwise it draws white text on  black background.&lt;br /&gt;
&lt;br /&gt;
The text screen on a Color Graphics Adapter (CGA) display supports sixteen colors, so it will show all combinations of background and foreground color just like Enhanced Graphics Adapter displays. On the graphics screen, CGA only has four colors, so AGI uses a table to choose foreground text colors when the background is black (if background is not black, foreground is always white, same as EGA displays):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;width:150px; text-align:center;&amp;quot; | Foreground&amp;lt;br /&amp;gt;Color&lt;br /&gt;
! style=&amp;quot;width:100px; text-align:center;&amp;quot; | CGA-0&lt;br /&gt;
! style=&amp;quot;width:100px; text-align:center;&amp;quot; | CGA-1&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 0 (black)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | black&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | black&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 1 (blue)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | green&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | cyan&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 2 (green)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | green&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | cyan&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 3 (cyan)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | green&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | cyan&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 4 (red)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | red&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | magenta&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 5 (magenta)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | red&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | magenta&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 6 (brown)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | red&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | magenta&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 7 (light gray)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | brown&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | white&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 8 (dark gray)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | brown&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | white&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 9 (light blue)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | green&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | cyan&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 10 (light green)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | green&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | cyan&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 11 (light cyan)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | red&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | magenta&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 12 (light red)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | red&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | magenta&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 13 (light magenta)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | red&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | magenta&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 14 (yellow)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | red&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | magenta&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width:150px; text-align:center;&amp;quot; | 15 (white)&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | brown&lt;br /&gt;
| style=&amp;quot;width:100px; text-align:center;&amp;quot; | white&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Using values for &amp;#039;&amp;#039;&amp;#039;FG&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;BG&amp;#039;&amp;#039;&amp;#039; greater than 15 will not cause AGI to crash, but may cause unexpected results. AGI uses only the lower nibble (four least significant bits) of each number to determine the actual colors to display. Internally, AGI combines the &amp;#039;&amp;#039;&amp;#039;FG&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;BG&amp;#039;&amp;#039;&amp;#039; values into a single 8 bit number that is used by the text drawing functions. Because of the way the numbers are combined, it is actually possible to draw black text on non-black backgrounds on the [[graphics]] screen. If &amp;#039;&amp;#039;&amp;#039;FG&amp;#039;&amp;#039;&amp;#039; is greater than 128 and &amp;#039;&amp;#039;&amp;#039;BG&amp;#039;&amp;#039;&amp;#039; is zero, AGI will use the higher nibble (upper four bits) of &amp;#039;&amp;#039;&amp;#039;FG&amp;#039;&amp;#039;&amp;#039; as the background color, and calls to &amp;#039;&amp;#039;&amp;#039;[[display]]&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;[[display.v]]&amp;#039;&amp;#039;&amp;#039; will draw black text on colored background. Using the &amp;#039;&amp;#039;&amp;#039;[[text.screen]]&amp;#039;&amp;#039;&amp;#039; command when this is the case will also clear the text screen to the &amp;#039;hacked&amp;#039; foreground color.&lt;br /&gt;
&lt;br /&gt;
== Possible Errors ==&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;agi&amp;quot;&amp;gt;&lt;br /&gt;
text.screen();&lt;br /&gt;
set.text.attribute(1, 14);&lt;br /&gt;
display(5, 5, &amp;quot;message text&amp;quot;); [ this will display blue text on a yellow background&lt;br /&gt;
graphics();&lt;br /&gt;
display(5, 5, &amp;quot;message text&amp;quot;); [ on graphics screen this will be black text on white background&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
| style=&amp;quot;background-color: #efefef&amp;quot; width=&amp;quot;200&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Required Interpreter Version:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
| width=&amp;quot;175&amp;quot; | Available in all AGI versions.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background-color: #efefef&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Byte-Code Value:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
| 109 (0x6D hex)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
[[Display Commands]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Category:Commands]]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Andrew Korson</name></author>
	</entry>
</feed>