@@ -397,17 +397,14 @@ initFrame:SetScript("OnEvent", function(self)
397397 { type = " slider" , text = " Title Size" , min = 8 , max = 24 , step = 1 ,
398398 getValue = function () return Cfg (" titleFontSize" ) or 11 end ,
399399 setValue = function (v ) Set (" titleFontSize" , v ); Refresh () end })
400+
401+ -- Title color: single custom swatch (unchanged behavior)
400402 do
401- local function AttachSwatch (rgn , label , colorKey , dr , dg , db , useAccent )
403+ local function AttachSwatch (rgn , label , colorKey , dr , dg , db )
402404 local sw = EllesmereUI .BuildColorSwatch (rgn , rgn :GetFrameLevel () + 5 ,
403405 function ()
404406 local c = Cfg (colorKey ) or {}
405- if c .r then return c .r , c .g , c .b end
406- if useAccent then
407- local eg = EllesmereUI .ELLESMERE_GREEN
408- if eg then return eg .r , eg .g , eg .b end
409- end
410- return dr , dg , db
407+ return c .r or dr , c .g or dg , c .b or db
411408 end ,
412409 function (r , g , b )
413410 local c = Cfg (colorKey ) or {}
@@ -419,10 +416,99 @@ initFrame:SetScript("OnEvent", function(self)
419416 sw :SetScript (" OnEnter" , function (s ) EllesmereUI .ShowWidgetTooltip (s , label .. " Color" ) end )
420417 sw :SetScript (" OnLeave" , function () EllesmereUI .HideWidgetTooltip () end )
421418 end
422- -- secColor passes useAccent=true so the swatch displays the
423- -- live accent when the user has not explicitly chosen a color
424- AttachSwatch (row ._leftRegion , " Header" , " secColor" , 0.047 , 0.824 , 0.624 , true )
425- AttachSwatch (row ._rightRegion , " Title" , " titleColor" , 1.0 , 0.85 , 0.1 )
419+ AttachSwatch (row ._rightRegion , " Title" , " titleColor" , 1.0 , 0.85 , 0.1 )
420+ end
421+
422+ -- Header color: double inline swatch (custom | accent), matching the
423+ -- CDM border-size pattern but using the live EllesmereUI accent
424+ -- instead of class color. Right swatch = accent mode (activates on
425+ -- click, shows live ELLESMERE_GREEN). Left swatch = custom color
426+ -- (activates on click, color picker opens). While accent mode is
427+ -- active, the custom swatch is dimmed and blocked.
428+ do
429+ local leftRgn = row ._leftRegion
430+ local ctrl = leftRgn ._control
431+ local PP = EllesmereUI .PP
432+
433+ -- Right (accent) swatch: one-click to activate accent mode.
434+ -- getValue reads ELLESMERE_GREEN live so theme/accent changes
435+ -- repaint the swatch automatically.
436+ local accentSwatch , updateAccentSwatch = EllesmereUI .BuildColorSwatch (
437+ leftRgn , row :GetFrameLevel () + 3 ,
438+ function ()
439+ local eg = EllesmereUI .ELLESMERE_GREEN
440+ if eg then return eg .r , eg .g , eg .b end
441+ return 0.047 , 0.824 , 0.624
442+ end ,
443+ function () end , -- no color picker, read-only display
444+ false , 20 )
445+ PP .Point (accentSwatch , " RIGHT" , ctrl , " LEFT" , - 8 , 0 )
446+ accentSwatch :SetScript (" OnClick" , function ()
447+ Set (" secColorUseAccent" , true )
448+ Refresh ()
449+ EllesmereUI :RefreshPage ()
450+ end )
451+ accentSwatch :SetScript (" OnEnter" , function ()
452+ EllesmereUI .ShowWidgetTooltip (accentSwatch , " Accent Color" )
453+ end )
454+ accentSwatch :SetScript (" OnLeave" , function () EllesmereUI .HideWidgetTooltip () end )
455+
456+ -- Left (custom) swatch: color picker when accent mode is off.
457+ local customSwatch , updateCustomSwatch = EllesmereUI .BuildColorSwatch (
458+ leftRgn , row :GetFrameLevel () + 3 ,
459+ function ()
460+ local c = Cfg (" secColor" ) or {}
461+ if c .r then return c .r , c .g , c .b end
462+ return 0.047 , 0.824 , 0.624
463+ end ,
464+ function (r , g , b )
465+ local c = Cfg (" secColor" ) or {}
466+ c .r = r ; c .g = g ; c .b = b
467+ Set (" secColor" , c )
468+ -- Picking a custom color implicitly disables accent mode
469+ Set (" secColorUseAccent" , false )
470+ Refresh ()
471+ end ,
472+ false , 20 )
473+ PP .Point (customSwatch , " RIGHT" , accentSwatch , " LEFT" , - 8 , 0 )
474+ customSwatch :SetScript (" OnEnter" , function ()
475+ EllesmereUI .ShowWidgetTooltip (customSwatch , " Custom Color" )
476+ end )
477+ customSwatch :SetScript (" OnLeave" , function () EllesmereUI .HideWidgetTooltip () end )
478+
479+ -- Block overlay: while accent mode is active, clicking the
480+ -- custom swatch flips accent mode off instead of opening the
481+ -- color picker. Prevents the user from accidentally picking a
482+ -- color before choosing whether to deviate from accent.
483+ local customBlock = CreateFrame (" Button" , nil , customSwatch )
484+ customBlock :SetAllPoints ()
485+ customBlock :SetFrameLevel (customSwatch :GetFrameLevel () + 10 )
486+ customBlock :EnableMouse (true )
487+ customBlock :SetScript (" OnClick" , function ()
488+ if Cfg (" secColorUseAccent" ) then
489+ Set (" secColorUseAccent" , false )
490+ Refresh ()
491+ EllesmereUI :RefreshPage ()
492+ end
493+ end )
494+ customBlock :SetScript (" OnEnter" , function ()
495+ EllesmereUI .ShowWidgetTooltip (customSwatch , " Custom Color" )
496+ end )
497+ customBlock :SetScript (" OnLeave" , function () EllesmereUI .HideWidgetTooltip () end )
498+
499+ local function UpdateHeaderSwatchState ()
500+ local useAccent = Cfg (" secColorUseAccent" )
501+ if useAccent then
502+ customSwatch :SetAlpha (0.3 ); customBlock :Show ()
503+ else
504+ customSwatch :SetAlpha (1 ); customBlock :Hide ()
505+ end
506+ accentSwatch :SetAlpha (useAccent and 1 or 0.3 )
507+ end
508+ EllesmereUI .RegisterWidgetRefresh (function ()
509+ updateCustomSwatch (); updateAccentSwatch (); UpdateHeaderSwatchState ()
510+ end )
511+ UpdateHeaderSwatchState ()
426512 end
427513 y = y - h
428514
0 commit comments