Open in the app to sign in, vote and reply

Suggestions · Open

New Feature Icon:addObcjet(className, objectName, parent)

Team · · 0 votes · 0 comments

To make deep customization much cleaner and more efficient, I’d like to propose a new method:

Icon:addObject(className: string, objectName: string, parent: Instance | string)

How it works
className: Instantiates the object internally via Instance.new(className).

objectName: Assigns a unique name/key to the created instance so TopbarPlus can track and reference it.

parent: Accepts either a direct Instance reference or a string matching the name of an existing internal widget/element within the icon (e.g., "IconButton", "IconImage", "IconLabel").

Once created and registered under objectName, the developer can style or animate its properties natively using

Icon:modifyTheme().

FAQ

How does this differ from Icon:addInstance()?

addInstance is specifically designed to mount custom GUI elements inside the icon's IconSpot container. addObject, on the other hand, lets you inject UI modifiers (gradients, strokes, corners) or decorative elements directly onto any target part of the icon's hierarchy and expose them to the theme system.

What is its main purpose?

To expand visual customization without requiring developers to fork or manually dig through the internal module hierarchy—making it seamless to apply theme-reactive gradients, borders, or custom effects.

Example Usage (image)
Here is an example adding a UIGradient to the main button that fades to semi-transparent in the center (Glass theme) while remaining visible on the edges, controlled through modifyTheme():

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Icon = require(ReplicatedStorage.Icon)

local testing = Icon.new()
	:setLabel("Gradient")
	:addObject("UIGradient", "ButtonGradient", "IconButton")
	:modifyTheme({
		"ButtonGradient",
		"Transparency",
		NumberSequence.new({
			NumberSequenceKeypoint.new(0, 0.7),     -- Totalmente visible en el borde izquierdo
			NumberSequenceKeypoint.new(0.4, 0.7), -- Semi-invisible en el centro
			NumberSequenceKeypoint.new(1, 0.2),     -- Totalmente visible en el borde derecho
		})
	})
image.png

Comments

No comments yet.