-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTheme.lua
More file actions
60 lines (51 loc) · 1.89 KB
/
Copy pathTheme.lua
File metadata and controls
60 lines (51 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
local ADDON_NAME, ns = ...
local Theme = {}
ns.Theme = Theme
-- Flat ElvUI / MerfinUI dark look, matching the user's other addons (CooldownCall).
-- Near-black background, thin pure-black border, class colour reserved for names.
-- Bundled Expressway (the "Merfin Font 1" used by MerfinUI/ElvUI) with an outline.
Theme.FONT = [[Interface\AddOns\Scry\Media\Expressway.ttf]]
Theme.FONT_FLAGS = "OUTLINE"
-- 1px-edge white texture for flat backdrops/borders.
Theme.WHITE = "Interface\\Buttons\\WHITE8X8"
-- Dark palette.
Theme.bg = { 0.09, 0.09, 0.09, 0.95 }
Theme.border = { 0, 0, 0, 1 }
Theme.rowAlt = { 1, 1, 1, 0.03 } -- faint zebra stripe over the bg
Theme.hover = { 1, 1, 1, 0.10 }
Theme.text = { 0.90, 0.90, 0.90 }
Theme.dim = { 0.55, 0.55, 0.58 }
Theme.bad = { 1.0, 0.42, 0.42 }
Theme.good = { 0.40, 0.85, 0.45 }
Theme.btnBg = { 0.16, 0.16, 0.16, 1 }
Theme.btnHover = { 0.24, 0.24, 0.26, 1 }
local FALLBACK = { r = 1.0, g = 0.82, b = 0.0 } -- unknown class -> gold
function Theme:ClassColor(classFile)
local c = classFile and RAID_CLASS_COLORS and RAID_CLASS_COLORS[classFile] or FALLBACK
return c.r, c.g, c.b
end
function Theme:Accent()
local _, classFile = UnitClass("player")
return self:ClassColor(classFile)
end
-- Re-font every FontString under `frame`, keeping each one's size but swapping the
-- family to Expressway+outline. Lets us skin widgets built from default GameFont*
-- objects without touching every CreateFontString call site.
function Theme:ApplyFontToFrame(frame)
if not frame then
return
end
if frame.GetRegions then
for _, r in ipairs({ frame:GetRegions() }) do
if r.GetObjectType and r:GetObjectType() == "FontString" then
local _, size = r:GetFont()
r:SetFont(self.FONT, size or 12, self.FONT_FLAGS)
end
end
end
if frame.GetChildren then
for _, c in ipairs({ frame:GetChildren() }) do
self:ApplyFontToFrame(c)
end
end
end