markrcote / flot-axislabels

Axis Labels Plugin for Flot. This repo is unmaintained in part due to flot being in a similar situation.
95 stars 71 forks source link

Use axisLabelColour (if set) for html labels, or omit inline css color #23

Closed apinkney97 closed 10 years ago

apinkney97 commented 10 years ago

HTML labels are currently hardcoded to use this.opts.color, which is used by flot for colouring gridlines. Since this is set as inline css, it's impossible to override with a stylesheet (using eg .axisLabels {color: black;}) and effectively means that the axis labels have to be the same colour as the gridlines.

This should probably use this.opts.axisLabelColour if it's been set, and otherwise omit the inline color declaration so that some global style can be applied.

Specifically the line

'color: ' + this.opts.color + '; ' + 

should be replaced with something like

(this.opts.axisLabelColour ? 'color: ' + this.opts.axisLabelColour + '; ' : '') +
markrcote commented 10 years ago

Good point. Thanks!

markrcote commented 10 years ago

Actually, I decided to remove that line altogether. Everything else (font family, size, etc.) is configurable via CSS, so there's no point in having an explicit option for colour (plus plain HTML mode doesn't support it).

Regardless, thanks for getting me thinking about it. :) I added you to the list of contributors.