Skip to content

Commit

Permalink
Rest of chart colors to CSS variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
wcjohns committed Jul 8, 2024
1 parent cfc91bb commit 3815348
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/ColorThemeWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ ColorThemeWidget::ColorThemeWidget(WContainerWidget *parent)
++row;
cell = table->elementAt(row, 0);
cell->addStyleClass( "CTRowLabel" );
new WLabel("Spectrum Chart Background", cell);
new WLabel("Spectrum Area", cell);
cell = table->elementAt(row, 1);

if( nativeColorSelect )
Expand All @@ -232,7 +232,7 @@ ColorThemeWidget::ColorThemeWidget(WContainerWidget *parent)
++row;
cell = table->elementAt(row, 0);
cell->addStyleClass( "CTRowLabel" );
new WLabel("Spectrum Chart Margins", cell);
new WLabel("Spectrum Chart Bckgrnd", cell);
cell = table->elementAt(row, 1);
cell->addStyleClass( "CTSelect" );
if( nativeColorSelect )
Expand All @@ -244,7 +244,7 @@ ColorThemeWidget::ColorThemeWidget(WContainerWidget *parent)
cell = table->elementAt(row, 2);
cell->addStyleClass( "CTRowDesc" );
new WText("Color for spectrum chart margins", cell);
m_specMarginSameAsBackground = new WCheckBox("Same as background", cell);
m_specMarginSameAsBackground = new WCheckBox("Same as spectrum area", cell);
m_specMarginSameAsBackground->setInline(false);


Expand Down
22 changes: 9 additions & 13 deletions src/D3SpectrumDisplayDiv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,8 @@ void D3SpectrumDisplayDiv::defineJavaScript()
void D3SpectrumDisplayDiv::initChangeableCssRules()
{
WCssStyleSheet &style = wApp->styleSheet();

m_cssRules["GridColor"] = style.addRule( ".xgrid > .tick, .ygrid > .tick", "stroke: #b3b3b3" );
m_cssRules["MinorGridColor"] = style.addRule( ".minorgrid", "stroke: #e6e6e6" );
m_cssRules["GridColor"] = style.addRule( ":root", "--d3spec-grid-major-color: #b3b3b3;" ); //Not actually needed, as CSS will default to this
m_cssRules["MinorGridColor"] = style.addRule( ":root", "--d3spec-grid-minor-color: #e6e6e6;" ); //Not actually needed, as CSS will default to this
}//void initChangeableCssRules()


Expand Down Expand Up @@ -1664,14 +1663,9 @@ void D3SpectrumDisplayDiv::setAxisLineColor( const Wt::WColor &color )
if( m_cssRules.count(rulename) )
style.removeRule( m_cssRules[rulename] );

m_cssRules[rulename] = style.addRule( ":root", "--d3spec-axis-color: " + m_axisColor.cssText() );

// Sets axis colors, and ".peakLine, .escapeLineForward, .mouseLine, .secondaryMouseLine"

//ToDo: is setting feature line colors okay like this
rulename = "FeatureLinesColor";
if( m_cssRules.count(rulename) )
style.removeRule( m_cssRules[rulename] );
m_cssRules[rulename] = style.addRule( ".peakLine, .escapeLineForward, .mouseLine, .secondaryMouseLine", "stroke: " + m_axisColor.cssText() );
m_cssRules[rulename] = style.addRule( ":root", "--d3spec-axis-color: " + m_axisColor.cssText() );

//ToDo: figure out how to make grid lines look okay.
//rulename = "GridColor";
Expand Down Expand Up @@ -1707,8 +1701,9 @@ void D3SpectrumDisplayDiv::setChartMarginColor( const Wt::WColor &color )
if( m_cssRules.count(rulename) )
style.removeRule( m_cssRules[rulename] );

m_cssRules[rulename] = style.addRule( ":root", "--d3spec-background-color: " + color.cssText() + ";" );
//Actually this will set the background for the entire chart...
m_cssRules[rulename] = style.addRule( "#" + id() + " > svg", "background: " + color.cssText() );
//m_cssRules[rulename] = style.addRule( "#" + id() + " > svg", "background: " + color.cssText() ); // to set background color for just this chart
}//setChartMarginColor(...)


Expand All @@ -1723,8 +1718,9 @@ void D3SpectrumDisplayDiv::setChartBackgroundColor( const Wt::WColor &color )

if( m_cssRules.count(rulename) )
style.removeRule( m_cssRules[rulename] );

m_cssRules[rulename] = style.addRule( "#chartarea" + id(), "fill: " + c );

m_cssRules[rulename] = style.addRule( ":root", "--d3spec-chart-area-color: " + c + ";" );
//m_cssRules[rulename] = style.addRule( "#chartarea" + id(), "fill: " + c ); //If we wanted to apply this color to only this chart
}

void D3SpectrumDisplayDiv::setDefaultPeakColor( const Wt::WColor &color )
Expand Down

0 comments on commit 3815348

Please sign in to comment.