@@ -160,29 +160,32 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
160160 void scheduleUpdateSecondData ();
161161
162162
163- /* * Schedules the foreground peaks to be re-loaded to the client during the
164- next call to #render (which Wt takes care of calling); this function is called by the PeakModel.
165- */
166- void scheduleForegroundPeakRedraw ();
167-
168- /* * Schedules peak redraw for the given spectrum.
169-
170- TODO: As of 20250802, only foreground spectrum has any effect.
163+ /* * Schedules the peaks to be re-loaded to the client, for the specified spectrum, during the
164+ next call to #render (which Wt takes care of calling).
171165 */
172166 void schedulePeakRedraw ( const SpecUtils::SpectrumType spectrum_type );
173167
174- /* * Applies the current color theme.
175- if nullptr, then sets to default colors.
168+ /* * Applies the color theme globally to all D3SpectrumDisplayDiv instances in the current app.
169+ Should be called once when the color theme changes, typically from InterSpec::applyColorTheme().
170+ If nullptr, then sets to default colors.
171+
172+ Uses InterSpecApp::setGlobalD3SpectrumCssRule() to track the global CSS rules per app instance.
176173 */
177- void applyColorTheme ( std::shared_ptr<const ColorTheme> theme );
178-
179- void setForegroundSpectrumColor ( const Wt::WColor &color );
180- void setBackgroundSpectrumColor ( const Wt::WColor &color );
181- void setSecondarySpectrumColor ( const Wt::WColor &color );
182- void setTextColor ( const Wt::WColor &color );
183- void setAxisLineColor ( const Wt::WColor &color );
184- void setChartMarginColor ( const Wt::WColor &color );
185- void setChartBackgroundColor ( const Wt::WColor &color );
174+ static void applyColorTheme ( std::shared_ptr<const ColorTheme> theme );
175+
176+ /* * Updates the default peak color for this specific instance based on the color theme.
177+ This is needed because peak color is passed in JSON, not via CSS variables.
178+ Also updates peak label size/rotation and log Y-axis min from theme.
179+ */
180+ void updateDefaultPeakColorForColorTheme ( std::shared_ptr<const ColorTheme> theme );
181+
182+ void overrideForegroundSpectrumColor ( const Wt::WColor &color );
183+ void overrideBackgroundSpectrumColor ( const Wt::WColor &color );
184+ void overrideSecondarySpectrumColor ( const Wt::WColor &color );
185+ void overrideTextColor ( const Wt::WColor &color );
186+ void overrideAxisLineColor ( const Wt::WColor &color );
187+ void overrideChartMarginColor ( const Wt::WColor &color );
188+ void overrideChartBackgroundColor ( const Wt::WColor &color );
186189 void setDefaultPeakColor ( const Wt::WColor &color );
187190
188191 /* * Sets the charts font size.
@@ -467,12 +470,6 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
467470 /* * Sets the highlight regions to client - currently unimplemented. */
468471 void setHighlightRegionsToClient ();
469472
470- void setForegroundPeaksToClient ();
471-
472- void setSecondaryPeaksToClient ();
473-
474- void setBackgroundPeaksToClient ();
475-
476473 void setReferenceLinesToClient ();
477474
478475protected:
@@ -500,7 +497,6 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
500497
501498 UpdateDynamicRefLines = 0x80 ,
502499
503- // TODO: Currently background and secondary peaks not loaded to client, so these flags have no effect.
504500 UpdateBackgroundPeaks = 0x0100 ,
505501 UpdateSecondaryPeaks = 0x0200 ,
506502 // ToDo: maybe add a few other things to this mechanism.
@@ -694,13 +690,17 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
694690 */
695691 int m_comptonPeakAngle;
696692
697- Wt::WColor m_foregroundLineColor;
698- Wt::WColor m_backgroundLineColor;
699- Wt::WColor m_secondaryLineColor;
700- Wt::WColor m_textColor;
701- Wt::WColor m_axisColor;
702- Wt::WColor m_chartMarginColor;
703- Wt::WColor m_chartBackgroundColor;
693+ // Member variables for instance-specific color overrides
694+ // When default (isDefault() == true), the global CSS variable from the theme is used
695+ Wt::WColor m_foregroundLineColorOverride;
696+ Wt::WColor m_backgroundLineColorOverride;
697+ Wt::WColor m_secondaryLineColorOverride;
698+ Wt::WColor m_textColorOverride;
699+ Wt::WColor m_axisColorOverride;
700+ Wt::WColor m_chartMarginColorOverride;
701+ Wt::WColor m_chartBackgroundColorOverride;
702+
703+ // Default peak color - used directly in JSON, not via CSS
704704 Wt::WColor m_defaultPeakColor;
705705
706706 std::string m_peakLabelFontSize;
0 commit comments