local inicfg = require 'inicfg'
-- Создание конфига
local mainIni = inicfg.load({
config = {
style = 0 -- Стиль 0.
}
}, "scrcfg.ini") -- Назваие ини.
-- К стилю обращаешься как: mainIni.config.style
if not doesFileExist('moonloader/config/scrcfg.ini') then -- Если по этому пути не создан ини
inicfg.save(mainIni, 'scrcfg.ini') -- То создаём его.
end
local window_style_selected = imgui.ImInt(mainIni.config.style) -- По умолчанию выбранная строчка в Combo (Первая)
local window_style = {u8"Серый", u8"Синий", u8"Тёмный", u8"Вишнёвый", u8"Тёмно-зелёный"} -- Список стилей
-- OnDrawFrame()
if imgui.Combo(u8"Стиль интерфейса", window_style_selected, window_style, window_style_selected) then
style(window_style_selected.v) -- Тут в функцию style() (со стилями) передаёшь номер выбранного комбо.
mainIni.config.style = window_style_selected.v -- Перезаписываешь номер стиля в ини.
inicfg.save(mainIni, 'scrcfg.ini') -- Ну и сохраняешь.
end
-- Сами стили
function style(id)
id = window_style_selected.v + 1 -- Тут присваиваем параметру функции наш номер выбранного стиля.
-- +1 - вроде потому, что нумерация комбо начинается с 0, а ID стилей с 1. (Могу ошибаться, но в целом всё работает =))
imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
style.WindowRounding = 2.0
style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
style.ChildWindowRounding = 2.0
style.FrameRounding = 2.0
style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
style.ScrollbarSize = 13.0
style.ScrollbarRounding = 0
style.GrabMinSize = 8.0
style.GrabRounding = 1.0
if id == 1 then -- default gray (https://www.blast.hk/threads/25442/post-473803)
colors[clr.Text] = ImVec4(0.95, 0.96, 0.98, 1.00)
colors[clr.TextDisabled] = ImVec4(0.36, 0.42, 0.47, 1.00)
colors[clr.WindowBg] = ImVec4(0.11, 0.15, 0.17, 1.00)
colors[clr.ChildWindowBg] = ImVec4(0.15, 0.18, 0.22, 1.00)
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94)
colors[clr.Border] = ImVec4(0.43, 0.43, 0.50, 0.50)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.FrameBg] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.FrameBgHovered] = ImVec4(0.12, 0.20, 0.28, 1.00)
colors[clr.FrameBgActive] = ImVec4(0.09, 0.12, 0.14, 1.00)
colors[clr.TitleBg] = ImVec4(0.09, 0.12, 0.14, 0.65)
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51)
colors[clr.TitleBgActive] = ImVec4(0.08, 0.10, 0.12, 1.00)
colors[clr.MenuBarBg] = ImVec4(0.15, 0.18, 0.22, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.39)
colors[clr.ScrollbarGrab] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.09, 0.21, 0.31, 1.00)
colors[clr.ComboBg] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.CheckMark] = ImVec4(0.28, 0.56, 1.00, 1.00)
colors[clr.SliderGrab] = ImVec4(0.28, 0.56, 1.00, 1.00)
colors[clr.SliderGrabActive] = ImVec4(0.37, 0.61, 1.00, 1.00)
colors[clr.Button] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.ButtonHovered] = ImVec4(0.28, 0.56, 1.00, 1.00)
colors[clr.ButtonActive] = ImVec4(0.06, 0.53, 0.98, 1.00)
colors[clr.Header] = ImVec4(0.20, 0.25, 0.29, 0.55)
colors[clr.HeaderHovered] = ImVec4(0.26, 0.59, 0.98, 0.80)
colors[clr.HeaderActive] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.26, 0.59, 0.98, 0.25)
colors[clr.ResizeGripHovered] = ImVec4(0.26, 0.59, 0.98, 0.67)
colors[clr.ResizeGripActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.CloseButton] = ImVec4(1.00, 0.39, 0.38, 0.56)
colors[clr.CloseButtonHovered] = ImVec4(1.00, 0.39, 0.38, 0.69)
colors[clr.CloseButtonActive] = ImVec4(1.00, 0.39, 0.38, 1.00)
colors[clr.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00)
colors[clr.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00)
colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
colors[clr.TextSelectedBg] = ImVec4(0.25, 1.00, 0.00, 0.43)
colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
elseif id == 2 then -- blue (https://www.blast.hk/threads/25442/post-262903)
colors[clr.FrameBg] = ImVec4(0.16, 0.29, 0.48, 0.54)
colors[clr.FrameBgHovered] = ImVec4(0.26, 0.59, 0.98, 0.40)
colors[clr.FrameBgActive] = ImVec4(0.26, 0.59, 0.98, 0.67)
colors[clr.TitleBg] = ImVec4(0.04, 0.04, 0.04, 1.00)
colors[clr.TitleBgActive] = ImVec4(0.16, 0.29, 0.48, 1.00)
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51)
colors[clr.CheckMark] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.SliderGrab] = ImVec4(0.24, 0.52, 0.88, 1.00)
colors[clr.SliderGrabActive] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.Button] = ImVec4(0.26, 0.59, 0.98, 0.40)
colors[clr.ButtonHovered] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.ButtonActive] = ImVec4(0.06, 0.53, 0.98, 1.00)
colors[clr.Header] = ImVec4(0.26, 0.59, 0.98, 0.31)
colors[clr.HeaderHovered] = ImVec4(0.26, 0.59, 0.98, 0.80)
colors[clr.HeaderActive] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.Separator] = colors[clr.Border]
colors[clr.SeparatorHovered] = ImVec4(0.26, 0.59, 0.98, 0.78)
colors[clr.SeparatorActive] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.26, 0.59, 0.98, 0.25)
colors[clr.ResizeGripHovered] = ImVec4(0.26, 0.59, 0.98, 0.67)
colors[clr.ResizeGripActive] = ImVec4(0.26, 0.59, 0.98, 0.95)
colors[clr.TextSelectedBg] = ImVec4(0.26, 0.59, 0.98, 0.35)
colors[clr.Text] = ImVec4(1.00, 1.00, 1.00, 1.00)
colors[clr.TextDisabled] = ImVec4(0.50, 0.50, 0.50, 1.00)
colors[clr.WindowBg] = ImVec4(0.06, 0.06, 0.06, 0.94)
colors[clr.ChildWindowBg] = ImVec4(1.00, 1.00, 1.00, 0.00)
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94)
colors[clr.ComboBg] = colors[clr.PopupBg]
colors[clr.Border] = ImVec4(0.43, 0.43, 0.50, 0.50)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.MenuBarBg] = ImVec4(0.14, 0.14, 0.14, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.53)
colors[clr.ScrollbarGrab] = ImVec4(0.31, 0.31, 0.31, 1.00)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.41, 0.41, 0.41, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.51, 0.51, 0.51, 1.00)
colors[clr.CloseButton] = ImVec4(0.41, 0.41, 0.41, 0.50)
colors[clr.CloseButtonHovered] = ImVec4(0.98, 0.39, 0.36, 1.00)
colors[clr.CloseButtonActive] = ImVec4(0.98, 0.39, 0.36, 1.00)
colors[clr.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00)
colors[clr.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00)
colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
colors[clr.ModalWindowDarkening] = ImVec4(0.80, 0.80, 0.80, 0.35)
elseif id == 3 then -- dark (https://www.blast.hk/threads/25442/post-262950)
colors[clr.Text] = ImVec4(0.80, 0.80, 0.83, 1.00)
colors[clr.TextDisabled] = ImVec4(0.24, 0.23, 0.29, 1.00)
colors[clr.WindowBg] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.ChildWindowBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
colors[clr.PopupBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
colors[clr.Border] = ImVec4(0.43, 0.43, 0.50, 0.50)
colors[clr.BorderShadow] = ImVec4(0.92, 0.91, 0.88, 0.00)
colors[clr.FrameBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.FrameBgHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
colors[clr.FrameBgActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.TitleBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.TitleBgCollapsed] = ImVec4(1.00, 0.98, 0.95, 0.75)
colors[clr.TitleBgActive] = ImVec4(0.07, 0.07, 0.09, 1.00)
colors[clr.MenuBarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.ScrollbarGrab] = ImVec4(0.80, 0.80, 0.83, 0.31)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.ComboBg] = ImVec4(0.19, 0.18, 0.21, 1.00)
colors[clr.CheckMark] = ImVec4(0.80, 0.80, 0.83, 0.31)
colors[clr.SliderGrab] = ImVec4(0.80, 0.80, 0.83, 0.31)
colors[clr.SliderGrabActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.Button] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.ButtonHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
colors[clr.ButtonActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.Header] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.HeaderHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.HeaderActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.ResizeGripHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.ResizeGripActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.CloseButton] = ImVec4(0.40, 0.39, 0.38, 0.16)
colors[clr.CloseButtonHovered] = ImVec4(0.40, 0.39, 0.38, 0.39)
colors[clr.CloseButtonActive] = ImVec4(0.40, 0.39, 0.38, 1.00)
colors[clr.PlotLines] = ImVec4(0.40, 0.39, 0.38, 0.63)
colors[clr.PlotLinesHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.40, 0.39, 0.38, 0.63)
colors[clr.PlotHistogramHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
colors[clr.TextSelectedBg] = ImVec4(0.25, 1.00, 0.00, 0.43)
colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
elseif id == 4 then -- cherry (https://www.blast.hk/threads/25442/post-479304)
colors[clr.Text] = ImVec4(0.860, 0.930, 0.890, 0.78)
colors[clr.TextDisabled] = ImVec4(0.860, 0.930, 0.890, 0.28)
colors[clr.WindowBg] = ImVec4(0.13, 0.14, 0.17, 1.00)
colors[clr.ChildWindowBg] = ImVec4(0.200, 0.220, 0.270, 0.58)
colors[clr.PopupBg] = ImVec4(0.200, 0.220, 0.270, 0.9)
colors[clr.Border] = ImVec4(0.43, 0.43, 0.50, 0.50)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.FrameBg] = ImVec4(0.200, 0.220, 0.270, 1.00)
colors[clr.FrameBgHovered] = ImVec4(0.455, 0.198, 0.301, 0.78)
colors[clr.FrameBgActive] = ImVec4(0.455, 0.198, 0.301, 1.00)
colors[clr.TitleBg] = ImVec4(0.232, 0.201, 0.271, 1.00)
colors[clr.TitleBgActive] = ImVec4(0.502, 0.075, 0.256, 1.00)
colors[clr.TitleBgCollapsed] = ImVec4(0.200, 0.220, 0.270, 0.75)
colors[clr.MenuBarBg] = ImVec4(0.200, 0.220, 0.270, 0.47)
colors[clr.ScrollbarBg] = ImVec4(0.200, 0.220, 0.270, 1.00)
colors[clr.ScrollbarGrab] = ImVec4(0.09, 0.15, 0.1, 1.00)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.455, 0.198, 0.301, 0.78)
colors[clr.ScrollbarGrabActive] = ImVec4(0.455, 0.198, 0.301, 1.00)
colors[clr.CheckMark] = ImVec4(0.71, 0.22, 0.27, 1.00)
colors[clr.SliderGrab] = ImVec4(0.47, 0.77, 0.83, 0.14)
colors[clr.SliderGrabActive] = ImVec4(0.71, 0.22, 0.27, 1.00)
colors[clr.Button] = ImVec4(0.47, 0.77, 0.83, 0.14)
colors[clr.ButtonHovered] = ImVec4(0.455, 0.198, 0.301, 0.86)
colors[clr.ButtonActive] = ImVec4(0.455, 0.198, 0.301, 1.00)
colors[clr.Header] = ImVec4(0.455, 0.198, 0.301, 0.76)
colors[clr.HeaderHovered] = ImVec4(0.455, 0.198, 0.301, 0.86)
colors[clr.HeaderActive] = ImVec4(0.502, 0.075, 0.256, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.47, 0.77, 0.83, 0.04)
colors[clr.ResizeGripHovered] = ImVec4(0.455, 0.198, 0.301, 0.78)
colors[clr.ResizeGripActive] = ImVec4(0.455, 0.198, 0.301, 1.00)
colors[clr.PlotLines] = ImVec4(0.860, 0.930, 0.890, 0.63)
colors[clr.PlotLinesHovered] = ImVec4(0.455, 0.198, 0.301, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.860, 0.930, 0.890, 0.63)
colors[clr.PlotHistogramHovered] = ImVec4(0.455, 0.198, 0.301, 1.00)
colors[clr.TextSelectedBg] = ImVec4(0.455, 0.198, 0.301, 0.43)
colors[clr.ModalWindowDarkening] = ImVec4(0.200, 0.220, 0.270, 0.73)
elseif id == 5 then -- dark green (https://www.blast.hk/threads/25442/post-653460)
colors[clr.Text] = ImVec4(1.00, 1.00, 1.00, 1.00)
colors[clr.TextDisabled] = ImVec4(0.50, 0.50, 0.50, 1.00)
colors[clr.WindowBg] = ImVec4(0.06, 0.06, 0.06, 0.94)
colors[clr.ChildWindowBg] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94)
colors[clr.Border] = ImVec4(0.43, 0.43, 0.50, 0.50)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.FrameBg] = ImVec4(0.44, 0.44, 0.44, 0.60)
colors[clr.FrameBgHovered] = ImVec4(0.57, 0.57, 0.57, 0.70)
colors[clr.FrameBgActive] = ImVec4(0.76, 0.76, 0.76, 0.80)
colors[clr.TitleBg] = ImVec4(0.04, 0.04, 0.04, 1.00)
colors[clr.TitleBgActive] = ImVec4(0.16, 0.16, 0.16, 1.00)
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.60)
colors[clr.MenuBarBg] = ImVec4(0.14, 0.14, 0.14, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.53)
colors[clr.ScrollbarGrab] = ImVec4(0.31, 0.31, 0.31, 1.00)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.41, 0.41, 0.41, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.51, 0.51, 0.51, 1.00)
colors[clr.CheckMark] = ImVec4(0.13, 0.75, 0.55, 0.80)
colors[clr.SliderGrab] = ImVec4(0.13, 0.75, 0.75, 0.80)
colors[clr.SliderGrabActive] = ImVec4(0.13, 0.75, 1.00, 0.80)
colors[clr.Button] = ImVec4(0.13, 0.75, 0.55, 0.40)
colors[clr.ButtonHovered] = ImVec4(0.13, 0.75, 0.75, 0.60)
colors[clr.ButtonActive] = ImVec4(0.13, 0.75, 1.00, 0.80)
colors[clr.Header] = ImVec4(0.13, 0.75, 0.55, 0.40)
colors[clr.HeaderHovered] = ImVec4(0.13, 0.75, 0.75, 0.60)
colors[clr.HeaderActive] = ImVec4(0.13, 0.75, 1.00, 0.80)
colors[clr.Separator] = ImVec4(0.13, 0.75, 0.55, 0.40)
colors[clr.SeparatorHovered] = ImVec4(0.13, 0.75, 0.75, 0.60)
colors[clr.SeparatorActive] = ImVec4(0.13, 0.75, 1.00, 0.80)
colors[clr.ResizeGrip] = ImVec4(0.13, 0.75, 0.55, 0.40)
colors[clr.ResizeGripHovered] = ImVec4(0.13, 0.75, 0.75, 0.60)
colors[clr.ResizeGripActive] = ImVec4(0.13, 0.75, 1.00, 0.80)
colors[clr.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00)
colors[clr.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00)
colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
colors[clr.TextSelectedBg] = ImVec4(0.26, 0.59, 0.98, 0.35)
colors[clr.ModalWindowDarkening] = ImVec4(0.80, 0.80, 0.80, 0.35)
end
end
style(1) -- Это стиль по умолчанию.