Difference between revisions of "ImGui.Style:setColor"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2020.9<br/> '''Class:''' ImGui.Style<br/> === Description === Sets a color to an ImGui element. <source lang="lua"> ImGui.Style:s...")
 
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Sets a color to an ImGui element.
 
Sets a color to an ImGui element.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
ImGui.Style:setColor(imguielement,color,alpha)
 
ImGui.Style:setColor(imguielement,color,alpha)
</source>
+
</syntaxhighlight>
  
 
=== Parameters ===
 
=== Parameters ===
'''imguielement''': (String) the ImGui element target '''([[ImGui|see ImGui Col constants]])'''<br/>
+
'''imguielement''': (String) the ImGui element target '''([[ImGui.CONST.Col|see ImGui.CONST.Col]])'''<br/>
 
'''color''': (number) the color in hex format<br/>
 
'''color''': (number) the color in hex format<br/>
 
'''alpha''': (number) the alpha between 0 and 1, default=1 '''optional'''<br/>
 
'''alpha''': (number) the alpha between 0 and 1, default=1 '''optional'''<br/>
  
 
=== Example ===
 
=== Example ===
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
local style = imgui:getStyle()
 
local style = imgui:getStyle()
 
style:setColor(ImGui.Col_TabHovered, 0x54575b, 0.83)
 
style:setColor(ImGui.Col_TabHovered, 0x54575b, 0.83)
 
style:setColor(ImGui.Col_NavWindowingHighlight, 0xffffff, 0.70)
 
style:setColor(ImGui.Col_NavWindowingHighlight, 0xffffff, 0.70)
 
style:setColor(ImGui.Col_FrameBgActive, 0xababaa, 0.39)
 
style:setColor(ImGui.Col_FrameBgActive, 0xababaa, 0.39)
</source>
+
</syntaxhighlight>
  
 
{{ImGui.Style}}
 
{{ImGui.Style}}

Latest revision as of 15:29, 13 July 2023

Available since: Gideros 2020.9
Class: ImGui.Style

Description

Sets a color to an ImGui element.

ImGui.Style:setColor(imguielement,color,alpha)

Parameters

imguielement: (String) the ImGui element target (see ImGui.CONST.Col)
color: (number) the color in hex format
alpha: (number) the alpha between 0 and 1, default=1 optional

Example

local style = imgui:getStyle()
style:setColor(ImGui.Col_TabHovered, 0x54575b, 0.83)
style:setColor(ImGui.Col_NavWindowingHighlight, 0xffffff, 0.70)
style:setColor(ImGui.Col_FrameBgActive, 0xababaa, 0.39)