fork/m-overlay

git clone https://git.julia.blue/fork/m-overlay

BkacjiosBugfixes + Dark Mode skina8034e9

v2.1.6
6.6 KiB250 linesraw
1local SKIN = gui.newSkin("default")
2
3SKIN.Background = color(255, 255, 255)
4
5SKIN.PanelBackground = color(200, 200, 200)
6SKIN.PanelBorder = color(165, 165, 165)
7SKIN.PanelFocused = color(0, 162, 232)
8
9SKIN.SubPanelBackground = color(215, 215, 215)
10
11SKIN.FrameBorder = color(100, 100, 100)
12SKIN.FrameControlBar = color(225, 225, 225)
13SKIN.FrameFocusedControlBar = color(0, 162, 232)
14
15SKIN.ButtonBackground = color(235, 235, 235)
16SKIN.ButtonDisabled = color(100, 100, 100, 100)
17SKIN.ButtonPressed = color(153, 217, 234)
18SKIN.ButtonHover = color(220, 242, 248)
19
20SKIN.ButtonClosePressed = color(243, 105, 113)
21SKIN.ButtonCloseHover = color(248, 167, 171)
22
23SKIN.TextEntryBackground = color(255, 255, 255)
24SKIN.TextEntryFocused = color(0, 162, 232)
25
26SKIN.ScrollBarGrip = color(235, 235, 235)
27SKIN.ScrollBarGripPressed = color(96, 96, 96, 255)
28SKIN.ScrollBarGripHover = color(166, 166, 166, 255)
29
30SKIN.CheckboxBorder = color(100, 100, 100)
31SKIN.CheckboxOff = color(200, 200, 200)
32SKIN.CheckboxOn = color(0, 162, 232)
33
34SKIN.TabActiveColor = color(0, 0, 0, 75)
35
36SKIN.LabelTextColor = color(0, 0, 0)
37SKIN.LabelShadowColor = color(100, 100, 100, 100)
38
39SKIN.ToolTipTitleColor = color(0, 178, 255)
40SKIN.ToolTipTitleShadowColor = color(100, 100, 100, 100)
41
42SKIN.ToolTipBodyColor = color(0, 0, 0)
43SKIN.ToolTipBodyShadowColor = color(100, 100, 100, 100)
44
45SKIN.CheckImage = graphics.newImage("textures/gui/checkmark.png")
46
47function SKIN:InitPanel(panel)
48	panel:SetBGColor(self.PanelBackground)
49	panel:SetBorderColor(self.PanelBorder)
50end
51
52function SKIN:PaintPanel(panel, w, h)
53	graphics.setColor(panel:GetBGColor())
54	graphics.rectangle("fill", 0, 0, w, h)
55end
56
57function SKIN:PaintOverlayPanel(panel, w, h)
58	graphics.setLineStyle("rough")
59	graphics.setLineWidth(1)
60	
61	graphics.setColor(panel:GetBorderColor())
62	graphics.innerRectangle(0, 0, w, h)
63end
64
65function SKIN:PaintSlider(panel, w, h)
66	graphics.setColor(self.Background)
67	graphics.rectangle("fill", 0, 0, w, h)
68
69	graphics.setLineStyle("rough")
70	graphics.setLineWidth(1)
71	
72	graphics.setColor(panel:GetBorderColor())
73	graphics.innerRectangle(0, 0, w, h)
74end
75
76function SKIN:PaintOverlayFocusPanel(panel, w, h)
77	graphics.setLineStyle("rough")
78	graphics.setLineWidth(1)
79
80	if panel:IsEnabled() and panel:HasFocus() then
81		graphics.setColor(self.PanelFocused)
82		graphics.innerRectangle(0, 0, w, h)
83	else
84		graphics.setColor(panel:GetBorderColor())
85		graphics.innerRectangle(0, 0, w, h)
86	end
87end
88
89function SKIN:PaintScrollBarButtonUp(panel, w, h)
90	self:PaintButton(panel,w,h)
91	graphics.setColor(150, 150, 150, 255)
92	graphics.polygon('fill', 4, 12, 8, 4, 12, 12)
93end
94
95function SKIN:PaintScrollBarButtonDown(panel, w, h)
96	self:PaintButton(panel,w,h)
97	graphics.setColor(150, 150, 150, 255)
98	graphics.polygon('fill', 4, 4, 12, 4, 8, 12)
99end
100
101function SKIN:PaintScrollBarGrip(panel, w, h)
102	self:PaintButton(panel,w,h)
103end
104
105function SKIN:InitButton(panel)
106	--[[panel:SetBGColor(self.ButtonBackground)
107	panel:SetBorderColor(self.PanelBorder)
108	panel:SetPressedColor(self.ButtonPressed)
109	panel:SetHoveredColor(self.ButtonHover)]]
110end
111
112function SKIN:InitExitButton(panel)
113	panel:SetPressedColor(self.ButtonClosePressed)
114	panel:SetHoveredColor(self.ButtonCloseHover)
115end
116
117function SKIN:PaintButton(panel, w, h)
118	local color = self.ButtonBackground
119
120	if panel:IsPressed() then
121		color = panel:GetPressedColor() or self.ButtonPressed
122	elseif panel:IsHovered() then
123		color = panel:GetHoveredColor() or self.ButtonHover
124	end
125
126	graphics.setColor(color)
127	graphics.rectangle("fill", 0, 0, w, h)
128
129	graphics.setLineStyle("rough")
130	graphics.setLineWidth(1)
131
132	graphics.setColor(panel:GetBorderColor() or self.PanelBorder)
133	graphics.innerRectangle(0, 0, w, h)
134end
135
136function SKIN:PaintTab(panel, w, h)
137	local color = self.ButtonBackground
138
139	if panel:IsPressed() then
140		color = panel:GetPressedColor() or self.ButtonPressed
141	elseif panel:IsHovered() then
142		color = panel:GetHoveredColor() or self.ButtonHover
143	end
144
145	graphics.setColor(panel:GetBorderColor() or self.PanelBorder)
146	graphics.roundRect(0, 0, w, h+8, 8)
147
148	graphics.setColor(color)
149	graphics.roundRect(1, 1, w-2, h+6, 8)
150
151	if panel:IsActive() then
152		graphics.setColor(panel:GetActiveColor() or self.TabActiveColor)
153		graphics.roundRect(1, 1, w-2, h+6, 8)
154	end
155end
156
157function SKIN:PaintOverlayButton(panel, w, h)
158	if not panel:IsEnabled() then
159		graphics.setColor(self.ButtonDisabled)
160		graphics.rectangle("fill", 0, 0, w, h)
161	end
162end
163
164function SKIN:PaintFrame(panel, w, h)
165	graphics.setColor(self.Background)
166	graphics.rectangle("fill", 0, 0, w, h)
167	
168	graphics.setColor(panel:HasFocus(true) and self.FrameFocusedControlBar or self.FrameControlBar)
169	graphics.rectangle("fill", 0, 0, w, 32)
170
171	graphics.setLineStyle("rough")
172	graphics.setLineWidth(1)
173	
174	--[[graphics.setColor(255, 255, 255, 255)
175	graphics.innerRectangle(0, 1, w, h - 2)]]
176	
177	graphics.setColor(panel.m_cBordercolor or self.FrameBorder)
178	graphics.innerRectangle(0, 0, w, h)
179end
180
181function SKIN:PaintTextEntry(panel, w, h)
182	graphics.setColor(self.TextEntryBackground)
183	graphics.rectangle("fill", 0, 0, w, h)
184
185	graphics.setLineStyle("rough")
186	graphics.setLineWidth(1)
187
188	if panel:HasFocus() then
189		graphics.setColor(self.TextEntryFocused)
190		graphics.innerRectangle(0, 0, w, h)
191	else
192		graphics.setColor(panel:GetBorderColor())
193		graphics.innerRectangle(0, 0, w, h)
194	end
195end
196
197function SKIN:PaintCheckBox(panel, w, h)
198	graphics.setColor(panel:IsToggled() and self.CheckboxOn or self.CheckboxOff)
199	graphics.rectangle("fill", 4, 4, h-8, h-8)
200
201	if panel:IsToggled() then
202		graphics.setColor(255, 255, 255, 255)
203		graphics.easyDraw(self.CheckImage, 4, 4, 0, h-8, h-8)
204	end
205	
206	graphics.setLineStyle("rough")
207	graphics.setLineWidth(1)
208	
209	graphics.setColor(self.CheckboxBorder)
210	graphics.rectangle("line", 4, 4, h-8, h-8)
211end
212
213function SKIN:PaintRadioBox(panel, w, h)
214	graphics.setColor(panel:IsToggled() and self.CheckboxOn or self.CheckboxOff)
215	graphics.circle("fill", 12, 12, h/2-6, 32)
216
217	graphics.setLineStyle("smooth")
218	graphics.setLineWidth(1)
219
220	graphics.setColor(self.CheckboxBorder)
221	graphics.circle("line", 12, 12, h/2-6, 32)
222end
223
224function SKIN:InitHorizontalSelect(panel)
225	panel:SetBGColor(self.PanelBackground)
226	panel:SetBorderColor(self.PanelBorder)
227end
228
229function SKIN:InitLabel(label)
230	label:SetTextColor(self.LabelTextColor)
231	label:SetShadowColor(self.LabelShadowColor)
232end
233
234function SKIN:InitSubPanel(panel)
235	panel:SetBGColor(self.SubPanelBackground)
236end
237
238function SKIN:InitTooltip(tooltip)
239	tooltip:SetTooltipColor(self.SubPanelBackground)
240end
241
242function SKIN:InitTooltipTitle(title)
243	title:SetShadowColor(self.ToolTipTitleShadowColor)
244	title:SetTextColor(self.ToolTipTitleColor)
245end
246
247function SKIN:InitTooltipBody(body)
248	body:SetShadowColor(self.ToolTipBodyShadowColor)
249	body:SetTextColor(self.ToolTipBodyColor)
250end