<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.gideros.rocks/index.php?action=history&amp;feed=atom&amp;title=Sprite%3AsetStyle</id>
	<title>Sprite:setStyle - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.gideros.rocks/index.php?action=history&amp;feed=atom&amp;title=Sprite%3AsetStyle"/>
	<link rel="alternate" type="text/html" href="https://wiki.gideros.rocks/index.php?title=Sprite:setStyle&amp;action=history"/>
	<updated>2026-11-17T23:55:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.gideros.rocks/index.php?title=Sprite:setStyle&amp;diff=24684&amp;oldid=prev</id>
		<title>MoKaLux at 19:27, 17 October 2025</title>
		<link rel="alternate" type="text/html" href="https://wiki.gideros.rocks/index.php?title=Sprite:setStyle&amp;diff=24684&amp;oldid=prev"/>
		<updated>2025-10-17T19:27:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&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-GB&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 19:27, 17 October 2025&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-l44&quot;&gt;Line 44:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 44:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;local spriteStyle={&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;local spriteStyle={&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;	__Parent=stageStyle, --Inherits from &amp;#039;stageStyle&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;	__Parent=stageStyle, --Inherits from &amp;#039;stageStyle&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&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;	color1=&quot;=baseColor:brightness:1.1&quot;,&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&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;	color1=&quot;=baseColor:brightness:1.1&quot;, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-- alpha, mix, brightness&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;	color2=&amp;quot;=baseColor:brightness:0.8&amp;quot;,&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;	color2=&amp;quot;=baseColor:brightness:0.8&amp;quot;,&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&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;	color3=&amp;quot;=baseColor:brightness:0.0&amp;quot;,&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&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;	color3=&amp;quot;=baseColor:brightness:0.0&amp;quot;,&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>MoKaLux</name></author>
	</entry>
	<entry>
		<id>https://wiki.gideros.rocks/index.php?title=Sprite:setStyle&amp;diff=24681&amp;oldid=prev</id>
		<title>MoKaLux: Created page with &quot;__NOTOC__ &#039;&#039;&#039;Available since:&#039;&#039;&#039; Gideros 2022.6&lt;br/&gt; &#039;&#039;&#039;Class:&#039;&#039;&#039; Sprite&lt;br/&gt;  === Description === Attaches a style table to a Sprite and mark it as dirty. This means that...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.gideros.rocks/index.php?title=Sprite:setStyle&amp;diff=24681&amp;oldid=prev"/>
		<updated>2025-10-17T18:58:18Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ &amp;#039;&amp;#039;&amp;#039;Available since:&amp;#039;&amp;#039;&amp;#039; Gideros 2022.6&amp;lt;br/&amp;gt; &amp;#039;&amp;#039;&amp;#039;Class:&amp;#039;&amp;#039;&amp;#039; &lt;a href=&quot;/index.php/Sprite&quot; title=&quot;Sprite&quot;&gt;Sprite&lt;/a&gt;&amp;lt;br/&amp;gt;  === Description === Attaches a style table to a Sprite and mark it as dirty. This means that...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Available since:&amp;#039;&amp;#039;&amp;#039; Gideros 2022.6&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Class:&amp;#039;&amp;#039;&amp;#039; [[Sprite]]&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
Attaches a style table to a Sprite and mark it as dirty. This means that a Sprite can now be given style references instead of plain values. Gideros will resolve the references to actual values thanks to Style tables at runtime.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
Sprite:setStyle(style)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;Currently styles are handled for Sprite layout constraints, layout parameters and for Pixel color (more may come in the future)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;style&amp;#039;&amp;#039;&amp;#039;: (table) the styling table&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local style={&lt;br /&gt;
	cellColor=vector(1,0,0,1) --cellColor is Red initially&lt;br /&gt;
}&lt;br /&gt;
for i=1,10 do&lt;br /&gt;
	local p=Pixel.new(vector(0,0,0,0),10,10)	&lt;br /&gt;
	p:setX((i-1)*15)&lt;br /&gt;
	p:setStyle(style)&lt;br /&gt;
	p:setColor(&amp;quot;cellColor&amp;quot;)&lt;br /&gt;
	stage:addChild(p)&lt;br /&gt;
end&lt;br /&gt;
Core.asyncCall(function()&lt;br /&gt;
	Core.yield(3) --Wait 3s&lt;br /&gt;
	style.cellColor=vector(0,1,0,1) --Set cellColor to green&lt;br /&gt;
	for i=1,10 do&lt;br /&gt;
		stage:getChildAt(i):setStyle(style)&lt;br /&gt;
		print(stage:getChildAt(i):resolveStyle(&amp;quot;cellColor&amp;quot;,style))&lt;br /&gt;
	end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;A checker board&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local stageStyle={&lt;br /&gt;
	baseColor=ColorValue(0.7,0.6,0,1)&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
local spriteStyle={&lt;br /&gt;
	__Parent=stageStyle, --Inherits from &amp;#039;stageStyle&amp;#039;&lt;br /&gt;
	color1=&amp;quot;=baseColor:brightness:1.1&amp;quot;,&lt;br /&gt;
	color2=&amp;quot;=baseColor:brightness:0.8&amp;quot;,&lt;br /&gt;
	color3=&amp;quot;=baseColor:brightness:0.0&amp;quot;,&lt;br /&gt;
}&lt;br /&gt;
for x=1,4 do&lt;br /&gt;
	for y=1,4 do&lt;br /&gt;
		local gradient=Pixel.new(0xFFFFFF,1,32,32)&lt;br /&gt;
		gradient:setPosition(128+x*32,128+y*32)&lt;br /&gt;
		gradient:setStyle(spriteStyle)&lt;br /&gt;
--		gradient:setColor(&amp;quot;color&amp;quot;..(1+((x+y)%2))) -- alternates between color1 and color2&lt;br /&gt;
		gradient:setColor(&amp;quot;color&amp;quot;..(1+((x+y)%3))) -- alternates between color1, color2 and color3&lt;br /&gt;
		stage:addChild(gradient)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
stage:addEventListener(Event.MOUSE_DOWN,function() &lt;br /&gt;
	stageStyle.baseColor=ColorValue(math.random(),math.random(),math.random(),1)&lt;br /&gt;
	stage:setStyle(stageStyle,true)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Sprite}}&lt;/div&gt;</summary>
		<author><name>MoKaLux</name></author>
	</entry>
</feed>