StyleBase

Show Deprecated
Not Creatable

The base class for StyleSheet and StyleRule. Holds a list of child StyleRules, as well as token definitions which are stored as attributes.

Summary

Methods

Properties

Methods

GetStyleRules

Instances

Returns an array of associated StyleRules.


Returns

Instances

Array of StyleRules.

InsertStyleRule

()

Inserts a new StyleRule into the array of rules so that its Priority is greater than all previous StyleRules. If priority is specified, sets the new rule's Priority to the specified value.

Parameters

rule: StyleRule

The StyleRule to insert.

Default Value: ""
priority: number

The number to set the rule's Priority to.

Default Value: ""

Returns

()

SetStyleRules

()

Similar to InsertStyleRule() but lets you declare and set multiple StyleRules at once.


local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = Instance.new("StyleSheet")
coreSheet.Name = "CoreSheet"
coreSheet.Parent = ReplicatedStorage
local styleRuleA = Instance.new("StyleRule")
styleRuleA.Selector = "Frame"
styleRuleA:SetProperty("BackgroundColor3", Color3.new(1, 0, 0))
local styleRuleB = Instance.new("StyleRule")
styleRuleB.Selector = "Frame"
styleRuleB:SetProperty("BackgroundColor3", Color3.new(0, 1, 0))
coreSheet:SetStyleRules({ styleRuleA, styleRuleB })

Parameters

rules: Instances

Array of StyleRules to set.

Default Value: ""

Returns

()

Events

StyleRulesChanged

Fires when one or more StyleRules is explicitly changed on the connected StyleSheet or StyleRule, for example when InsertStyleRule() is called.