Theming controls colors, fills, and other aspects of the visual appearance of plots. There are two concepts in Chartreuse's theme system:
- themes, which specify collections of values that control the visual appearance of plots; and
- Themeable values, which allow the user to override the theme values with settings of their own choice.
Themes are found within the
Most users will apply a theme to a whole plot, using a PlotTheme.
There are a small number of predefined
PlotThemes available in Chartreuse:
- default, the default theme;
- the themes defined within base16:
defaultDark, and so on.
- bmh; and
To apply a theme to a
Plot, pass it to the
draw method. For example, instead of calling
aPlot.draw(640, 480, PlotTheme.base16.defaultLight)
Where a value in Chartreuse can be themed it is represented as a Themeable value.
For example, Curve contains a LayoutTheme which in turn contains
Themeable values for
fillColor, and so on.
Themeable value specifies either a Default, which will be overriden by the theme's value, if there is one, or an Override, which will override the theme's value. So, for example, if a
Themeable.Default(Color.red), this value will be overriden by the theme's
strokeColor. However, if the value is
Themeable.Override(Color.red) it will override the theme.
Themeable values it's usually the case you want to override the theme. Here's an example creating a Line layout and overriding the theme with custom stroke color and width.
Line .default[Point] .forThemeable(theme => theme .withStrokeColor(Themeable.Override(Some(Color.darkBlue))) .withStrokeWidth(Themeable.Override(3.0)) )
Here are examples of some of the available themes.