The ColorPickerFrame primarily uses the ColorPickerFrame.func to tell something that is has been used to "select" a color (as the mouse drags across it etc..). You can use it with any widget that has a region that can change color (Texture, FontString) or to just to get the changed r, g, b values.
You can create a Button, make it look like anything then eg.
Lua Code:
local function CancelColor()
local prevColor = ColorPickerFrame.previousValues
local colorBox = ColorPickerFrame.colorBox.Texture
colorBox:SetVertexColor(prevColor.r, prevColor.g, prevColor.b)
end
local function ColorChanged()
local r, g, b = ColorPickerFrame:GetColorRGB()
local colorBox = ColorPickerFrame.colorBox.Texture
colorBox:SetVertexColor(r, g, b)
-- maybe save the settings to Saved Variables or ...?
end
local f = CreateFrame("Button", ...) -- Create a button to open the ColorPicker
f:SetSize(20, 20)
f:SetPoint(...)
f.Texture = f:CreateTexture()
f.Texture:SetAllPoints()
f.Texture:SetTexture("Interface\\BUTTONS\\WHITE8X8")-- just a white square but could be anything (presumably white)
f.Texture:SetVertexColor( some r, g, b settings possibly from SavedVariables)
f:SetScript("OnClick", function(self)
ColorPickerFrame.colorBox = self
local startColor = { r, g, b settings possibly copied from SavedVariables }
ColorPickerFrame.previousValues = startColor
ColorPickerFrame.cancelFunc = CancelColor
ColorPickerFrame.opacityFunc = ColorChanged
ColorPickerFrame.func = ColorChanged
ColorPickerFrame:SetColorRGB(startColor.r, startColor.g, startColor.b) -- Set the starting color of the ColorPickerFrame
ColorPickerFrame:ClearAllPoints()
ColorPickerFrame:SetPoint(...)
ColorPickerFrame:Show()
end)
Just the basic basics. You would need to decide what to do to make it work for your situation (and fix any errors, cold coded).
If you want to use a different color picker maybe
color picker advanced but I don't know how that one works but presumably the same...ish