Crosshair Color Picker

Hey trying to figure out a way for players to chose a color for their crosshair using DColorMixer
How can I make the selected color a player selects in the mixer be the color for the players crosshair?


local frame = vgui.Create( "DFrame" )
frame:SetSize( 267, 186 ) --good size for example
frame:Center()
frame:MakePopup()

local Mixer = vgui.Create( "DColorMixer", frame )
Mixer:Dock( FILL )			--Make Mixer fill place of Frame
Mixer:SetPalette( true ) 		--Show/hide the palette			DEF:true
Mixer:SetAlphaBar( true ) 		--Show/hide the alpha bar		DEF:true
Mixer:SetWangs( true )			--Show/hide the R G B A indicators 	DEF:true
Mixer:SetColor( Color( 30, 100, 160 ) )	--Set the default color


hook.Add("HUDPaint", "DrawMyHud", function()
local CrossHair = {}

if CrossHair then
	surface.SetDrawColor(255, 255, 255, 255)

	surface.DrawRect(ScrW()/2, ScrH()/2 - 3, 1, 7)

	surface.DrawRect(ScrW()/2 - 3, ScrH()/2, 7, 1)
	
end
end)

local function HideThings( name )
	if(name == "CHudCrosshair") then
             return false
        end
        -- We don't return anything here otherwise it will overwrite all other 
        -- HUDShouldDraw hooks.
end
hook.Add( "HUDShouldDraw", "HideThings", HideThings )


Store a variable of the default color. And when the value is changed in the ColorMixer, change the variable to that value. Then, use the variable in the crosshair color.

And how do I go about doing that… :3
I’ve never touched DColorMixer before

Well, simply use this function to get the desired colour:

DColorMixer:GetColor

You can then ~store~ the desired colour in a global variable for simplicity or any other method. If you can’t get it working, give me a shout on Steam.

Yeah I’ll probably need your help on this one! I’ve sent you a request on steam :slight_smile:
Thanks for helping me :slight_smile: