rfc format drawn from /luau-lang/rfcs/blob/master/TEMPLATE.md
GuiObject.TransparencyModifier
Summary
This feature request aims to add TransparencyModifier
-esque properties to applicable GuiObject
instances. It behaves similarly to BasePart.LocalTransparencyModifier but for GuiObjects.
Motivation
As of writing, there is no “direct” way to apply GuiService.PreferredTransparency
to GuiObjects. This makes it a bit cumbersome when designing interfaces that respect the aforementioned property (details of which outlined in Introducing Accessibility Settings). Addition of TransparencyModifier
properties would help bridge such a gap. These properties, in-line with BasePart.LocalTransparencyModifier
, are marked with Hidden
as to not confuse surface-level users with two transparency properties.
Design
generally:
truetransparency = 1 - ((1 - guiobject.Transparency) * (1 - guiobject.TransparencyModifier))
GuiObject:
GuiObject.BackgroundTransparencyModifier
affects GuiObject.BackgroundTransparency
UIStroke:
UIStroke.TransparencyModifier
affects UIStroke.Transparency
Frame:
(BackgroundTransparency
inherited from GuiObject
)
ScrollingFrame:
ScrollingFrame.ScrollBarImageTransparencyModifier
affects ScrollingFrame.ScrollBarImageTransparency
TextLabel:
TextLabel.TextTransparencyModifier
affects TextLabel.TextTransparency
TextLabel.TextStrokeTransparencyModifier
affects TextLabel.TextStrokeTransparency
TextButton:
TextButton.TextTransparencyModifier
affects TextButton.TextTransparency
TextButton.TextStrokeTransparencyModifier
affects TextButton.TextStrokeTransparency
TextBox:
TextBox.TextTransparencyModifier
affects TextBox.TextTransparency
TextBox.TextStrokeTransparencyModifier
affects TextBox.TextStrokeTransparency
ImageLabel:
ImageLabel.ImageTransparencyModifier
affects TextBox.ImageTransparency
ImageButton:
ImageButton.ImageTransparencyModifier
affects ImageButton.ImageTransparency
Drawbacks
Slightly bloats the GuiObject
class and any instances that inherit from it:
- Adds 1 property to the
GuiObject
class. - Adds 1 property to
Frame
. - Adds 2 properties to
UIStroke
,ScrollingFrame
,ImageLabel
,ImageButton
. - Adds 3 properties to
TextLabel
,TextButton
,TextBox
.
Possibly (unsure about the inner workings of the interface renderer) adds another “step” to interface rendering.
Alternatives
At runtime, all guiobjects and their associated transparency properties are cached then changed with respect to GuiService.PreferredTransparency
/ GuiService:GetPropertyChangedSignal("PreferredTransparency")
.