Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Theme = { };
- --
- Theme.Settings = { };
- -- Theme Settings
- Theme.Settings.Color = { ['R'] = 255; ['G'] = 255; ['B'] = 255; ['A'] = 255; }; --// Red, Green, Blue, Alpha/Transparency.
- Theme.Settings.Rainbow = true; --// If true then it will ignore Settings.Color. If false then the menus color will stick to Settings.Color.
- Theme.Settings.TransitionSpeed = 10; --// Indicates how many secounds it should take to transition all the way through the colors.
- Theme.Settings.Fps = 60; --// Just set your usual fps and it should alighn the transition speed pretty acuratly.
- -- SetColor
- function Theme:SetColor( Color )
- local R, G, B, Alpha = math.floor( tonumber( Color.R ) ), math.floor( tonumber( Color.G ) ), math.floor( tonumber( Color.B ) ), math.floor( tonumber( Color.A ) );
- menu.set_color(menu_color.FrameBgActive, R, G, B);
- menu.set_color(menu_color.SliderGrab, R, G, B);
- menu.set_color(menu_color.SliderGrabActive, R, G, B);
- menu.set_color(menu_color.CheckMark, R, G, B);
- menu.set_color(menu_color.ScrollbarGrab, R, G, B);
- menu.set_color(menu_color.ScrollbarGrabHovered, R, G, B);
- menu.set_color(menu_color.ScrollbarGrabActive, R, G, B);
- menu.set_widget_color(menu_widget_color.Icons, R, G, B, Alpha);
- menu.set_widget_color(menu_widget_color.ScrollbarGrab, R, G, B, Alpha );
- menu.set_widget_color(menu_widget_color.ScrollbarGrabHovered, R, G, B, Alpha);
- menu.set_widget_color(menu_widget_color.ScrollbarGrabActive, R, G, B, Alpha);
- menu.set_widget_color(menu_widget_color.TitleName, R, G, B, Alpha);
- menu.set_widget_color(menu_widget_color.NotifyRectLine, R, G, B, Alpha);
- menu.set_widget_color(menu_widget_color.NotifyIcon, R, G, B, Alpha);
- menu.set_widget_color(menu_widget_color.NotifyDefault, R, G, B, Alpha);
- menu.set_widget_color(menu_widget_color.NotifySuccess, R, G, B, Alpha);
- menu.set_alpha( Alpha );
- end;
- -- GetNextColor
- function Theme:GetNextColor( InitPoint )
- local function GetPositiveAngleDiff( a, b )
- return a < b and a + 360 - b or a - b;
- end;
- local Angle = InitPoint * 360;
- local Color = { };
- for i = 1, 3 do
- local Start = ( ( i + 1 ) * 120 ) % 360;
- local DiffFromStart = GetPositiveAngleDiff( Angle, Start );
- if DiffFromStart < 60 then
- Color[i] = DiffFromStart / 60 * 255;
- elseif DiffFromStart <= 180 then
- Color[i] = 255;
- elseif DiffFromStart < 240 then
- Color[i] = ( 240 - DiffFromStart ) / 60 * 255;
- else
- Color[i] = 0;
- end;
- end;
- return Color[1], Color[2], Color[3];
- end
- -- OnDone
- function OnDone( )
- menu.restore_styles( );
- end;
- -- OnFrame
- function OnFrame()
- if Theme.Settings.Rainbow and menu.is_menu_opened( ) then
- local Hue = ( system.ticks( ) + _G.Seed ) % ( (Theme.Settings.Fps * Theme.Settings.TransitionSpeed) * (Theme.Settings.TransitionSpeed) ) / ( (Theme.Settings.Fps * Theme.Settings.TransitionSpeed) * (Theme.Settings.TransitionSpeed) );
- local R, G, B = Theme:GetNextColor( Hue );
- Theme.Settings.Color.R = R;
- Theme.Settings.Color.G = G;
- Theme.Settings.Color.B = B;
- Theme:SetColor( Theme.Settings.Color );
- end;
- end;
- -- OnInit
- function OnInit( )
- menu.restore_styles( );
- _G.Seed = math.random( ) * 10;
- if not Theme.Settings.Rainbow then
- Theme:SetColor( Theme.Settings.Color );
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement