Last active
August 1, 2021 03:27
-
-
Save ecurtiss/241056e72b006c03e4768613c5b49f5e to your computer and use it in GitHub Desktop.
Visualize all Roblox Studio style guide colors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Visualize all Roblox Studio style guide colors | |
-- List of colors: https://developer.roblox.com/en-us/api-reference/enum/StudioStyleGuideColor | |
-- PASTE INTO THE COMMAND BAR | |
local ChangeHistoryService = game:GetService("ChangeHistoryService") | |
local Themes = settings().Studio:GetAvailableThemes() | |
local StudioStyleGuideColors = Enum.StudioStyleGuideColor:GetEnumItems() | |
local StudioStyleGuideModifiers = Enum.StudioStyleGuideModifier:GetEnumItems() | |
local USE_BILLBOARDS = true -- false uses Humanoid names | |
local PART_LENGTH = 4 | |
local COLOR_OFFSET = 8 | |
local MODIFIER_OFFSET = 16 | |
local THEME_OFFSET = MODIFIER_OFFSET * (#StudioStyleGuideModifiers + 1) | |
local DEC_TO_HEX_DIGITS = {[0] = "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"} | |
local function DecToHex(x) | |
local quotient = x / 16 | |
return DEC_TO_HEX_DIGITS[math.floor(quotient)] .. DEC_TO_HEX_DIGITS[math.floor(16 * (quotient % 1))] | |
end | |
for x, theme in ipairs(Themes) do | |
for y, color in ipairs(StudioStyleGuideColors) do | |
for z, modifier in ipairs(StudioStyleGuideModifiers) do | |
local cframe = CFrame.new( | |
(x - 1) * THEME_OFFSET + (z - 1) * MODIFIER_OFFSET, | |
PART_LENGTH / 2, | |
(y - 1) * COLOR_OFFSET | |
) | |
local name = theme.Name .. "." .. color.Name .. "." .. modifier.Name | |
local themeColor = theme:GetColor(color, modifier) | |
local r, g, b = themeColor.R * 255, themeColor.G * 255, themeColor.B * 255 | |
local labelText = string.format("%s\n%d, %d, %d\n#%s%s%s", name, r, g, b, DecToHex(r), DecToHex(g), DecToHex(b)) | |
local part = Instance.new("Part") | |
part.Anchored = true | |
part.BottomSurface = Enum.SurfaceType.Smooth | |
part.CFrame = cframe | |
part.Color = themeColor | |
part.Size = Vector3.new(1, 1, 1) * PART_LENGTH | |
part.TopSurface = Enum.SurfaceType.Smooth | |
if USE_BILLBOARDS then | |
part.Name = name | |
local billboardGui = Instance.new("BillboardGui") | |
billboardGui.Adornee = part | |
billboardGui.AlwaysOnTop = true | |
billboardGui.ClipsDescendants = false | |
billboardGui.MaxDistance = 50 | |
billboardGui.Size = UDim2.fromScale(4, 2) | |
billboardGui.StudsOffsetWorldSpace = Vector3.new(0, 4, 0) | |
billboardGui.Parent = part | |
local textLabel = Instance.new("TextLabel") | |
textLabel.BackgroundTransparency = 1 | |
textLabel.Font = Enum.Font.GothamBold | |
textLabel.Size = UDim2.fromScale(1, 1) | |
textLabel.Text = labelText | |
textLabel.TextColor3 = Color3.new(1, 1, 1) | |
textLabel.TextSize = 16 | |
textLabel.TextStrokeColor3 = Color3.new() | |
textLabel.TextStrokeTransparency = 0 | |
textLabel.Parent = billboardGui | |
part.Parent = workspace | |
else | |
local model = Instance.new("Model") | |
model.Name = labelText | |
part.Name = "Head" | |
part.Parent = model | |
local humanoid = Instance.new("Humanoid") | |
humanoid.NameDisplayDistance = 50 | |
humanoid.NameOcclusion = Enum.NameOcclusion.NoOcclusion | |
humanoid.Parent = model | |
model.Parent = workspace | |
end | |
end | |
end | |
end | |
ChangeHistoryService:SetWaypoint("ShowStudioColors") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
USE_BILLBOARDS = true
USE_BILLBOARDS = false