Studio Dark Theme

This is amazing!! Thank you so much I’ve wanted this for awhile.

My eyes are so much more relaxed while scripting now!

1 Like

This misses a lot of matches. For example, with your script, the only match for (53, 53, 53) is:

Compatable theme: Dark
 Guide: Enum.StudioStyleGuideColor.Titlebar
 Modifier: Enum.StudioStyleGuideModifier.Default

But with the script that I use:

local Studio = settings().Studio
local Theme = Studio.Theme

local function areColorsEqual(a, b)
	local a_r, a_g, a_b = a.r*255, a.g*255, a.b*255
	local b_r, b_g, b_b = b.r*255, b.g*255, b.b*255
	
	return math.abs(a_r - b_r) < 0.5 and math.abs(a_g - b_g) < 0.5 and math.abs(a_b - b_b) < 0.5
end

function getMatchingEnumsForColor(targetColor)
	for _, guide in next, Enum.StudioStyleGuideColor:GetEnumItems() do
		local modifierMatches = {}
		for _, modifier in next, Enum.StudioStyleGuideModifier:GetEnumItems() do
			local color = Theme:GetColor(guide, modifier)
			if areColorsEqual(targetColor, color) then
				table.insert(modifierMatches, modifier)
			end
		end
		
		if #modifierMatches > 0 then
			print(guide.Name)
			for _, modifier in next, modifierMatches do
				print("     ", modifier.Name)
			end
		end
	end
end

getMatchingEnumsForColor(Color3.fromRGB(53, 53, 53))

Prints the following, provided that the current theme is Dark (all of which are correct matches):

Titlebar
      Default
      Selected
      Pressed
      Disabled
      Hover
Tooltip
      Default
      Selected
      Pressed
      Disabled
      Hover
Tab
      Default
      Pressed
      Disabled
RibbonTab
      Default
      Pressed
      Disabled
InputFieldBackground
      Disabled
CategoryItem
      Default
      Selected
      Pressed
      Disabled
      Hover
GameSettingsTooltip
      Default
      Selected
      Pressed
      Disabled
      Hover
DiffFilePathBackground
      Default
      Selected
      Pressed
      Disabled
      Hover
ButtonBorder
      Default
      Selected
      Pressed
      Disabled
      Hover
CheckedFieldBackground
      Disabled
HeaderSection
      Default
      Selected
      Disabled
1 Like

Hey XAXA, the code I provided was an example that I whipped up for myself in a few minutes, you’re absolutely right that the code doesn’t give all the matches, I’ll most likely edit the code later so that this works as expected.

Although your code works great, this only works for one theme, so the corresponding color on another theme may not be the same when attempting to find the correct guide and modifier

Edit: I’ve fixed the code :+1:

1 Like