Seventeen variables cover every themed part of a tile: the two plot strokes and fills, the series dot pattern, both stroke widths, the text colour, the axis rules, both grids and their dot patterns, the plot background, the edge shading, the restart rule, and the gridline a tile too small for a minor grid keeps.
Fonts are the exception and are not here. A graph reads --monospaced and --bodyfont from the console's own font stylesheet, so a second pair here could only disagree with the page it is drawn on.
The stylesheet is the canonical statement of a theme's look. The values held in this class are one fallback set - light's, because light is the console's default look - reached only when a theme's stylesheet declares nothing at all: an unknown theme name, or a layout with no stylesheet. Neither case has a theme identity to honour, so nothing here is per-theme; anything that genuinely differs between themes differs in the CSS.
A theme opts in by declaring variables in its console.css:
:root{
--graph_plotLine1:#64c8a0;
--graph_plotFill1:#64c8a05a;
--graph_plotDash:1.5;
--graph_plotLineWidthWide:2.5;
}
Anything absent keeps the built-in default, so no theme has to be edited and a typo in one declaration costs that one value rather than the whole frame.Not every stroke width is the theme's: GraphRenderer overrides it for a grouped axis, a crowded tile and the sidebar sparkline, because those are legibility decisions about one layout rather than a look.
Why the file is read server-side
A graph image is served as<img src="/viewstat.jsp?...">, which makes the SVG an isolated document: page CSS does not reach it and page custom properties are invisible inside. Declaring the variables in the SVG itself would only let a user edit a file they cannot reach, so the theme's own stylesheet is parsed here and the resolved values are handed to the renderer. That also means getComputedStyle is not involved and the minigraph's client-side path does not apply here.Caching
One small file per theme, parsed at most once and held in aConcurrentHashMap, since every graph tile on a console page asks for the same palette. Themes do not change while the router runs, so there is no invalidation hook; a theme edit takes effect on the next restart, the same as any other installed resource.Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classA theme's parsed declarations and the timestamps they were parsed from.Field Summary
Modifier and TypeFieldDescriptionprivate static final ColorFallback axis rule colour, used only when a theme declares no--graph_axisColor.private static final ColorFallback plot background, used only when a theme declares no--graph_background.private static final Map<String, GraphThemeColors.Entry> Theme directory plus theme name to its parsed declarations.static final intFrame width, in pixels, at or below which a condensed plot takesVAR_PLOT_LINE_WIDTH_CONDENSED.private static final PatternDash-list separator: commas and/or whitespace.private static final PatternMatches one custom property declaration, anywhere in the stylesheet.private static final floatFallback series dot length, used only when a theme declares no--graph_plotDash.private static final ColorFallback edge shading, used only when a theme declares no--graph_edgeShade.private static final PatternA gradient's leading direction, which an area under a series does not paint.private static final ColorFallback gridline for a tile too small for a minor grid, used only when a theme declares no--graph_gridCompact.private static final float[]Fallback major-gridline dot and gap, used only when a theme declares no--graph_gridMajorDash.private static final ColorFallback major gridline colour, used only when a theme declares no--graph_gridMajor.private static final float[]Fallback minor-gridline dot and gap, used only when a theme declares no--graph_gridMinorDash.private static final ColorFallback minor gridline colour, used only when a theme declares no--graph_gridMinor.private static final StringThe gradient function a fill variable may use; matched case-insensitively.private static final intLongest dash array accepted: one dot and one gap.private static final floatLargest line width of the graphs.(package private) static longHow long a parse may be reused even when the timestamp looks unchanged, in ms.private static final floatBounds on a declared stroke width: a hairline is not a line, and a width past the point of covering the data is not a theme's to choose.private static final longMarker for "the stylesheet is not there", which is a cacheable state of its own.private static final Color[]Fallback fill for each plot, used only when a theme declares no--graph_plotFill<N>.private static final Color[]Fallback stroke for each plot, used only when a theme declares no--graph_plotLine<N>.private static final floatFallback plot-line stroke width for a narrow, condensed plot, used only when a theme declares no--graph_plotLineWidthCondensed.private static final floatFallback plot-line stroke width, used only when a theme declares no--graph_plotLineWidth.private static final floatFallback forVAR_PLOT_LINE_WIDTH_FILLED_CONDENSED, used only when a theme declares no such variable.private static final floatFallback stroke width for the line over a filled plot, used only when a theme declares no--graph_plotLineWidthFilled.private static final floatFallback forVAR_PLOT_LINE_WIDTH_FILLED_WIDE, used only when a theme declares no such variable.private static final floatFallback plot-line stroke width pastWIDE_WIDTH, used only when a theme declares no--graph_plotLineWidthWide.static final intPlots per frame.private static final ColorFallback restart rule colour, used only when a theme declares no--graph_restartMarker.private static final ColorFallback text colour, used only when a theme declares no--graph_textColor.static final StringWhere the console keeps its themes, relative to the router base directory.static final StringThe two axis rules.static final StringThe plot area's own background, behind the gridlines.static final StringThe shading band drawn along the bottom and left edges of the plot area.static final StringThe gridline a tile too small for a minor grid keeps, which is not necessarily either of its two grids: the shipped themes split on which one they would rather drop.static final StringThe major gridlines.static final StringDot length for the major gridlines; zero asks for solid gridlines.static final StringThe minor gridlines.static final StringDot length for the minor gridlines; zero asks for solid gridlines.static final StringDash length, in pixels, of the multi-plot dot pattern; zero asks for a solid line.(package private) static final StringPrefix of the per-plot fill variables;--graph_plotFill1,--graph_plotFill2.(package private) static final StringPrefix of the per-plot stroke variables;--graph_plotLine1,--graph_plotLine2.static final StringStroke width, in pixels, of a plot line on a tile up toWIDE_WIDTH.static final StringStroke width, in pixels, of a plot line on a narrow tile carrying condensed data.static final StringStroke width, in pixels, of the line drawn over a filled plot.static final StringStroke width, in pixels, of the line over a filled plot on a narrow, condensed frame.static final StringStroke width, in pixels, of the line over a filled plot on a frame pastWIDE_WIDTH.static final StringStroke width, in pixels, of a plot line pastWIDE_WIDTH, where the series is long enough that a thinner stroke breaks up into dashes.static final StringThe vertical rule and legend entry marking a router restart.static final StringText colour: axis labels, tick labels, the legend and the title.static final intFrame width, in pixels, past whichVAR_PLOT_LINE_WIDTH_WIDEreplacesVAR_PLOT_LINE_WIDTH.private static final PatternSpace-separated stop separator; a stop may itself contain commas, so never split on those.Constructor Summary
ConstructorsModifierConstructorDescriptionprivateNot called, the class is only a collection of static methods.Method Summary
Modifier and TypeMethodDescriptionstatic ColorThe axis rule colour.static ColorbackgroundColor(File themeDir, String theme) The plot area's own background: the rectangle behind the gridlines.private static intclampPlot(int plot) Limits the plot index to the color range.(package private) static voidForget every parsed theme.static ColorcompactGridColor(File themeDir, String theme) The gridline a tile too small for a minor grid keeps in place of the minor grid.private static float[]Parse--graph_plotDashinto a dot length and a stated gap.private static float[]Parse a dash variable into a dot length and a stated gap.static floatThe space after each dot, as stated by the theme, or zero when the renderer should derive it from the line width.static floatdashLength(File themeDir, String theme) The dot ink length for the pattern that distinguishes the second plot from the first.private static ColorThe colour a theme declared, or null when it declared nothing usable.private static ColordeclaredInk(String value) The ink a declaration names: a colour, or the first stop of a gradient.private static ColordefaultLine(int plot) Fallback stroke for a plot.private static ColordefaultPath(int plot) Fallback fill for a plot.static ColoredgeShadeColor(File themeDir, String theme) The shading band along the bottom and left edges of the plot area.private static ColorOne frame element's colour: the theme's, or the built-in fallback.gradientStops(String value) The colour stops of alinear-gradient()declaration, in the order written.static ColorgridMajorColor(File themeDir, String theme) The major gridline colour.static floatgridMajorDash(File themeDir, String theme) Dot length for the major gridlines, or zero for solid ones.static floatgridMajorDashGap(File themeDir, String theme) The space after each major gridline dot, or zero to derive it.static ColorgridMinorColor(File themeDir, String theme) The minor gridline colour.static floatgridMinorDash(File themeDir, String theme) Dot length for the minor gridlines, or zero for solid ones.static floatgridMinorDashGap(File themeDir, String theme) The space after each minor gridline dot, or zero to derive it from the stroke width.static FileThe directory the console is installed into, taken from the running context.private static floatOne declared length, bounded, or the built-in fallback.static ColorThe stroke colour for a plot on a frame.static Color[]lineValueShade(File themeDir, String theme, int plot) The stops that shade plot lines by their value, or null when lines are drawn flat.Read a theme's stylesheet and collect its custom properties.private static float[]parseDashList(String value) Read one or two whitespace- or comma-separated lengths.parseStops(String[] terms, boolean gradient) Colours from already-split terms, dropping a direction keyword where one is allowed.static ColorThe fill colour for a plot on a frame.static PaintThe fill for a plot as something to paint with: a colour, or a vertical gradient.static floatplotLineWidth(File themeDir, String theme) Stroke width of a plot line on a tile no wider thanWIDE_WIDTH.static floatplotLineWidthCondensed(File themeDir, String theme) Stroke width of a plot line on a tile no wider thanCONDENSED_WIDTHthat carries condensed data.static floatplotLineWidthFilled(File themeDir, String theme) Stroke width of the line drawn over a filled plot.static floatplotLineWidthFilledCondensed(File themeDir, String theme) Stroke width of the line over a filled plot on a narrow, condensed frame.static floatplotLineWidthFilledWide(File themeDir, String theme) Stroke width of the line over a filled plot on a frame wider thanWIDE_WIDTH.static floatplotLineWidthWide(File themeDir, String theme) Stroke width of a plot line on a tile wider thanWIDE_WIDTH.static ColorrestartMarkerColor(File themeDir, String theme) The vertical rule and legend entry marking a router restart.private static String[]splitGradientStops(String body) Split a gradient's own stop list on its commas, ignoring commas inside parentheses.private static longRead a file's stamp, treating an absent file as its own cacheable state.static ColorThe text colour: axis labels, tick labels, the legend and the title.private static FileLocate a theme'sconsole.css.The theme's declarations, re-parsed whenever the stylesheet changes.
Field Details
THEME_SUBDIR
Where the console keeps its themes, relative to the router base directory.docs/themes/console, which is where the theme picker scans (ConfigUIHelper) and where an installed router puts them - not underwebapps, which holds the deployed console war. Getting this wrong is silent: every lookup takes the "no stylesheet" path and falls back to the built-in defaults, so a theme edit appears to do nothing at all.- See Also:
VAR_PLOT_DASH
Dash length, in pixels, of the multi-plot dot pattern; zero asks for a solid line.- See Also:
VAR_TEXT_COLOR
Text colour: axis labels, tick labels, the legend and the title.- See Also:
VAR_AXIS_COLOR
VAR_GRID_MINOR
VAR_GRID_MAJOR
VAR_GRID_MINOR_DASH
Dot length for the minor gridlines; zero asks for solid gridlines.- See Also:
VAR_GRID_MAJOR_DASH
Dot length for the major gridlines; zero asks for solid gridlines.- See Also:
VAR_BACKGROUND
The plot area's own background, behind the gridlines.- See Also:
VAR_EDGE_SHADE
The shading band drawn along the bottom and left edges of the plot area.- See Also:
VAR_RESTART_MARKER
The vertical rule and legend entry marking a router restart.- See Also:
VAR_GRID_COMPACT
The gridline a tile too small for a minor grid keeps, which is not necessarily either of its two grids: the shipped themes split on which one they would rather drop.- See Also:
VAR_PLOT_LINE_WIDTH
Stroke width, in pixels, of a plot line on a tile up toWIDE_WIDTH.- See Also:
VAR_PLOT_LINE_WIDTH_WIDE
Stroke width, in pixels, of a plot line pastWIDE_WIDTH, where the series is long enough that a thinner stroke breaks up into dashes.- See Also:
VAR_PLOT_LINE_WIDTH_CONDENSED
Stroke width, in pixels, of a plot line on a narrow tile carrying condensed data.Distinct from
VAR_PLOT_LINE_WIDTHbecause the ordinary weight is tuned for a series with room to separate. Pack the same number of points into a narrower frame and the polyline's segments crowd together, so the weight that reads well on a roomy plot fills in on a condensed one. Themes ship 2 here against 3 for the ordinary plot.- See Also:
VAR_PLOT_LINE_WIDTH_FILLED
Stroke width, in pixels, of the line drawn over a filled plot.Its own variable because it is not the plot line.
VAR_PLOT_LINE_WIDTHand its siblings state how heavy a plot line is; this one states how heavy the edge over a fill is, and the two are chosen for different jobs. It used to be half the plot width, which meant a theme could not set a readable fill edge without also reweighting every line plot in the console.- See Also:
VAR_PLOT_LINE_WIDTH_FILLED_WIDE
Stroke width, in pixels, of the line over a filled plot on a frame pastWIDE_WIDTH.The filled family needs its own wide variant for the same reason the plot family does: a longer series shows a thinner stroke's gaps more readily. Without it a wide filled graph was stuck on the ordinary filled weight, so raising
--graph_plotLineWidthWidedid nothing there - the two families read separate variables, so a theme could not widen one without widening the other.- See Also:
VAR_PLOT_LINE_WIDTH_FILLED_CONDENSED
Stroke width, in pixels, of the line over a filled plot on a narrow, condensed frame.The third member of the filled family, matching the plot family's plain, wide and condensed. Without it the filled edge had only one weight, so a narrow filled graph drew the same edge as a roomy one - which is the crowding the condensed slot exists to answer, just on the filled path where it had no slot to answer it in.
- See Also:
WIDE_WIDTH
public static final int WIDE_WIDTHFrame width, in pixels, past whichVAR_PLOT_LINE_WIDTH_WIDEreplacesVAR_PLOT_LINE_WIDTH.A layout constant rather than a theme choice: a tile is drawn wider when the console has room for it, and a longer series shows a thinner stroke's gaps more readily, so the two are the same decision seen from either end.
- See Also:
CONDENSED_WIDTH
public static final int CONDENSED_WIDTHFrame width, in pixels, at or below which a condensed plot takesVAR_PLOT_LINE_WIDTH_CONDENSED.A layout constant, like
WIDE_WIDTH: the question is whether the points have room to separate, which is a property of the frame rather than of the theme.- See Also:
VAR_PLOT_LINE_PREFIX
Prefix of the per-plot stroke variables;--graph_plotLine1,--graph_plotLine2.- See Also:
VAR_PLOT_FILL_PREFIX
Prefix of the per-plot fill variables;--graph_plotFill1,--graph_plotFill2.- See Also:
PLOTS
DECL
Matches one custom property declaration, anywhere in the stylesheet.LINEAR_GRADIENT
The gradient function a fill variable may use; matched case-insensitively.- See Also:
GRADIENT_DIRECTION
A gradient's leading direction, which an area under a series does not paint.DASH_SPLIT
Dash-list separator: commas and/or whitespace.WS_SPLIT
Space-separated stop separator; a stop may itself contain commas, so never split on those.CACHE
Theme directory plus theme name to its parsed declarations.NO_FILE
private static final long NO_FILEMarker for "the stylesheet is not there", which is a cacheable state of its own.- See Also:
maxCacheAgeMs
static long maxCacheAgeMsHow long a parse may be reused even when the timestamp looks unchanged, in ms.The timestamp check is what normally keeps this current, and it means an edit is visible on the very next page load. This interval is the fallback for a filesystem that does not maintain last-modified reliably - a network mount, some container overlays, or a coarse timestamp that hides two saves in the same second. Re-reading on a timer as well costs one small file read per interval, which is nothing next to rendering the graph itself.
Not a static final so tests can shorten it instead of sleeping.
PLOT_LINE
Fallback stroke for each plot, used only when a theme declares no--graph_plotLine<N>.Light's pair, because light is the console's default look. A theme with a palette of its own states it in its own
console.css, which is where the palette belongs: a derivation here could not also be canonical, since a stylesheet may declare any colour it likes.PLOT_FILL
Fallback fill for each plot, used only when a theme declares no--graph_plotFill<N>.Light's pair, alpha included, for the reason given on
PLOT_LINE.The fills are translucent because a frame carries two of them and they overlap wherever the series cross. At the 78-86% the fills used to carry, the crossing was so nearly opaque that neither series read through it - the shape you most want to see was the one you could not.
DEFAULT_DASH
private static final float DEFAULT_DASHFallback series dot length, used only when a theme declares no--graph_plotDash.Zero asks for a solid line, which is what a frame with no theme to be should draw. Every shipped theme asks for a solid series of its own, so none of them relies on it.
- See Also:
GRID_MINOR_DASH_DEFAULT
private static final float[] GRID_MINOR_DASH_DEFAULTFallback minor-gridline dot and gap, used only when a theme declares no--graph_gridMinorDash. A zero dot is a solid gridline.GRID_MAJOR_DASH_DEFAULT
private static final float[] GRID_MAJOR_DASH_DEFAULTFallback major-gridline dot and gap, used only when a theme declares no--graph_gridMajorDash. A zero dot is a solid gridline.TEXT_COLOR_DEFAULT
Fallback text colour, used only when a theme declares no--graph_textColor.AXIS_COLOR_DEFAULT
Fallback axis rule colour, used only when a theme declares no--graph_axisColor.The text ink, since an axis carries the labels that sit along it.
GRID_MINOR_DEFAULT
Fallback minor gridline colour, used only when a theme declares no--graph_gridMinor. Faint enough to sit behind the series.GRID_MAJOR_DEFAULT
Fallback major gridline colour, used only when a theme declares no--graph_gridMajor. Twice the minor grid's weight, which is the whole of the difference from it.BACKGROUND_DEFAULT
Fallback plot background, used only when a theme declares no--graph_background. Opaque, since it is what a frame with no stylesheet sits on.EDGE_SHADE_DEFAULT
Fallback edge shading, used only when a theme declares no--graph_edgeShade.RESTART_MARKER_DEFAULT
Fallback restart rule colour, used only when a theme declares no--graph_restartMarker.GRID_COMPACT_DEFAULT
Fallback gridline for a tile too small for a minor grid, used only when a theme declares no--graph_gridCompact. Light's, which is its major grid.PLOT_LINE_WIDTH_DEFAULT
private static final float PLOT_LINE_WIDTH_DEFAULTFallback plot-line stroke width, used only when a theme declares no--graph_plotLineWidth.Light's, and what every shipped theme declares today. The renderer has separate reasons to draw a thinner or thicker line - a dense tile, the sidebar sparkline - and those stay in
GraphRendererrather than here: they are legibility decisions about one layout, not something a theme picks.Pinned to what every shipped theme declares, so a console whose stylesheet cannot be read draws its plots the same weight as one that can.
- See Also:
PLOT_LINE_WIDTH_WIDE_DEFAULT
private static final float PLOT_LINE_WIDTH_WIDE_DEFAULTFallback plot-line stroke width pastWIDE_WIDTH, used only when a theme declares no--graph_plotLineWidthWide.Equal to
PLOT_LINE_WIDTH_DEFAULT, which is what the width rule did before either variable existed. The two are separate so a theme can weight a long series more heavily without changing the rest of the console.Was 2.5 while every shipped theme declared 4, for the same reason as
PLOT_LINE_WIDTH_DEFAULT.- See Also:
PLOT_LINE_WIDTH_CONDENSED_DEFAULT
private static final float PLOT_LINE_WIDTH_CONDENSED_DEFAULTFallback plot-line stroke width for a narrow, condensed plot, used only when a theme declares no--graph_plotLineWidthCondensed.Equal to
PLOT_LINE_WIDTH_DEFAULT, so a theme that says nothing about the condensed case gets the same weight as an ordinary plot and only the themes that declare the variable opt into the thinner condensed weight.- See Also:
PLOT_LINE_WIDTH_FILLED_DEFAULT
private static final float PLOT_LINE_WIDTH_FILLED_DEFAULTFallback stroke width for the line over a filled plot, used only when a theme declares no--graph_plotLineWidthFilled.What the old half-the-plot-width rule produced for every shipped theme, so a theme that omits the variable draws the same edge it drew before the variable existed.
- See Also:
PLOT_LINE_WIDTH_FILLED_WIDE_DEFAULT
private static final float PLOT_LINE_WIDTH_FILLED_WIDE_DEFAULTFallback forVAR_PLOT_LINE_WIDTH_FILLED_WIDE, used only when a theme declares no such variable.What the old half-the-plot-width rule produced for a wide plot of every shipped theme (4 × 0.5), so an ordinary theme draws the same wide filled edge it drew before the variable existed.
- See Also:
PLOT_LINE_WIDTH_FILLED_CONDENSED_DEFAULT
private static final float PLOT_LINE_WIDTH_FILLED_CONDENSED_DEFAULTFallback forVAR_PLOT_LINE_WIDTH_FILLED_CONDENSED, used only when a theme declares no such variable.Two thirds of
PLOT_LINE_WIDTH_FILLED_DEFAULT, the same step the plot family takes from its ordinary width to its condensed one (2 of 3). The old coupled rule gave a condensed filled edge the ordinary filled weight, which is what made a narrow filled graph look heavy.- See Also:
MIN_LINE_WIDTH
private static final float MIN_LINE_WIDTHBounds on a declared stroke width: a hairline is not a line, and a width past the point of covering the data is not a theme's to choose.- See Also:
MAX_LINE_WIDTH
private static final float MAX_LINE_WIDTHLargest line width of the graphs.- See Also:
MAX_DASH_VALUES
private static final int MAX_DASH_VALUESLongest dash array accepted: one dot and one gap.- See Also:
Constructor Details
GraphThemeColors
private GraphThemeColors()Not called, the class is only a collection of static methods.
Method Details
defaultLine
Fallback stroke for a plot.- Parameters:
plot- the plot ordinal- Returns:
- the built-in stroke, used when the theme declares no
--graph_plotLine<N>
defaultPath
Fallback fill for a plot.- Parameters:
plot- the plot ordinal- Returns:
- the built-in fill, used when the theme declares no
--graph_plotFill<N>
lineColor
The stroke colour for a plot on a frame.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme nameplot- the plot ordinal, 0 for the first line and 1 for the second- Returns:
- the colour, never null; falls back to the built-in value
lineValueShade
The stops that shade plot lines by their value, or null when lines are drawn flat.A plot line's declaration is read for this as well as for
lineColor(File, String, int), so a theme opts in by naming two or more colours where it used to name one:--graph_plotLine1:#2ec23e40 #f0000008 #d0000008;
The line is then drawn with a vertical gradient across the plot area, so the colour at a point is the colour for the value at that point - height is the value. The declared single colour still does its other jobs: it is the legend swatch, and it is what is drawn when the plot area is too short to span.
Read per plot, so the two lines on one axis are shaded independently like every other plot colour. A theme can shade one line by value and leave the other flat.
- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme nameplot- the plot ordinal, 0 for the first line and 1 for the second- Returns:
- bottom-to-top stops, or null when the theme named one colour or fewer
pathColor
The fill colour for a plot on a frame.A
linear-gradient()declaration has no single colour, so its first stop is reported here: that is the ink the fill is made of.pathPaint(File, String, int, int)returns the whole wash.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme nameplot- the plot ordinal, 0 for the first path and 1 for the second- Returns:
- the colour, never null; falls back to the built-in value
pathPaint
The fill for a plot as something to paint with: a colour, or a vertical gradient.A gradient needs a length to span, and the area under a series is a vertical wash, so the frame's height is the caller's to supply. Only the CSS default direction - top to bottom, which is what the minigraph's own fill variables use - is painted; a stated direction this class cannot honour is treated as no opinion rather than a guess, and the fill comes out as its ink.
Two stops are painted as a
GradientPaintand three or more as aLinearGradientPaint, which is the only one of the two that holds an arbitrary number. Either way the stops are spread evenly down the span, so a third stop lands a third of the way down rather than wherever the declaration happened to say.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme nameplot- the plot ordinal, 0 for the first path and 1 for the secondframeHeight- the height of the frame in pixels, which a gradient spans- Returns:
- the fill paint, never null; falls back to the built-in colour
dashLength
The dot ink length for the pattern that distinguishes the second plot from the first.--graph_plotDashtakes either a bare length or a CSS dash pair:--graph_plotDash:1 a 1px dot, gap derived from the line width --graph_plotDash:1 3 a 1px dot followed by 3px of space --graph_plotDash:1,3 the same, for a comma-separated habit --graph_plotDash:0 no pattern at all: a solid line --graph_plotDash:0 3 the same; a gap needs a dot to follow it
- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme name- Returns:
- the dot length in pixels, or zero when the stylesheet asked for a solid line
dashGap
The space after each dot, as stated by the theme, or zero when the renderer should derive it from the line width.A stated value is not a promise:
RrdGraphConstantsraises anything too tight to keep the dots apart, because with round caps each dot lays downdot + widthof ink and a gap at or below the width merges them into a solid line. Reporting the raw value keeps this class a plain reader of the stylesheet.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme name- Returns:
- the stated gap in pixels, or zero to derive one
element
One frame element's colour: the theme's, or the built-in fallback.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme namevar- the custom property the element readsfallback- the built-in colour, used when the theme declares nothing usable- Returns:
- the colour, never null
textColor
axisColor
gridMinorColor
gridMajorColor
gridMinorDash
gridMinorDashGap
The space after each minor gridline dot, or zero to derive it from the stroke width.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme name- Returns:
- the stated gap in pixels, or zero to derive one
gridMajorDash
gridMajorDashGap
backgroundColor
edgeShadeColor
The shading band along the bottom and left edges of the plot area.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme name- Returns:
- the colour, never null; fully transparent where a theme drops the band
restartMarkerColor
compactGridColor
plotLineWidth
Stroke width of a plot line on a tile no wider thanWIDE_WIDTH.A renderer decision outranks this one - see
GraphRendererfor the dense-tile and sparkline widths - so a theme sets the weight of an ordinary plot, not every plot.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme name- Returns:
- the width in pixels, never zero or negative
plotLineWidthWide
Stroke width of a plot line on a tile wider thanWIDE_WIDTH.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme name- Returns:
- the width in pixels, never zero or negative
- See Also:
plotLineWidthCondensed
Stroke width of a plot line on a tile no wider thanCONDENSED_WIDTHthat carries condensed data.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme name- Returns:
- the width in pixels, never zero or negative
- See Also:
plotLineWidthFilled
Stroke width of the line drawn over a filled plot.Independent of
plotLineWidth(File, String)and its siblings: this is an edge on a fill, not a plot line, and the two are set for different reasons.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme name- Returns:
- the width in pixels, never zero or negative
- See Also:
plotLineWidthFilledWide
Stroke width of the line over a filled plot on a frame wider thanWIDE_WIDTH.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme name- Returns:
- the width in pixels, never zero or negative
- See Also:
plotLineWidthFilledCondensed
Stroke width of the line over a filled plot on a narrow, condensed frame.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme name- Returns:
- the width in pixels, never zero or negative
- See Also:
length
One declared length, bounded, or the built-in fallback.An absent variable and an unusable one are the same case on purpose: both mean the theme has no opinion, so both fall back rather than failing the render.
- Parameters:
themeDir- the console themes root holding the theme's CSStheme- the console theme name whose variables are readvar- the CSS custom property name to look upfallback- the built-in width, used when the variable is absent or out of range- Returns:
- the width in pixels, within
MIN_LINE_WIDTHandMAX_LINE_WIDTH
dash
Parse a dash variable into a dot length and a stated gap.- Parameters:
themeDir- the console themes root holding the theme's CSStheme- the console theme name whose variables are readvar- the CSS custom property name to look upfallback- the built-in{dot, gap}, used when the variable is absent or unusable- Returns:
{dot, gap}, with a dot of zero meaning "no pattern" and a gap of zero meaning "derive it"; never null
dash
Parse--graph_plotDashinto a dot length and a stated gap.- Parameters:
themeDir- the console themes root holding the theme's CSStheme- the console theme name whose variables are read- Returns:
{dot, gap}, with a dot of zero meaning "no pattern" and a gap of zero meaning "derive it"; never null
parseDashList
Read one or two whitespace- or comma-separated lengths.Longer lists are refused rather than truncated. CSS would cycle an odd-length
stroke-dasharrayto make it even, but the minimum-gap rule below is stated for a single dot and gap, and silently dropping the rest would render something the stylesheet never asked for.- Parameters:
value- the raw variable text, one or two lengths separated by whitespace or commas- Returns:
- the values, or null when the text is not a usable dash list
clampPlot
private static int clampPlot(int plot) Limits the plot index to the color range.- Parameters:
plot- the index of the plot- Returns:
- the index within the colors
declared
The colour a theme declared, or null when it declared nothing usable.An absent variable and an unparseable one are the same case on purpose: both mean "this theme has no opinion about this slot", so both fall back to the default.
- Parameters:
themeDir- the console themes root holding the theme's CSStheme- the console theme name whose variables are readvar- the CSS custom property name to look up- Returns:
- the parsed colour, or null if the theme omits var or names an unparseable value
declaredInk
The ink a declaration names: a colour, or the first stop of a gradient.A gradient is a wash rather than a colour, so a caller that wants one colour - a legend swatch, an alpha check - gets the ink the wash is made of.
- Parameters:
value- the raw declaration text, a colour or a gradient, null yields null- Returns:
- the colour named, or null if value is null or names nothing parseable
gradientStops
The colour stops of alinear-gradient()declaration, in the order written.A leading direction is skipped rather than obeyed: an area under a series is a vertical wash, so only the endpoints say anything, and a direction this class cannot paint is a no-op rather than a guess. A stop's stated position is dropped for the same reason - it moves where the middle of the wash sits, not which inks it is between.
- Parameters:
value- the raw declaration text, a linear-gradient() or a bare colour list- Returns:
- the stops, or null when the value is not a gradient this class paints
splitGradientStops
Split a gradient's own stop list on its commas, ignoring commas inside parentheses.A plain split would cut
rgba(0,0,0,.5)into three fragments that parse as nothing, which discarded the whole declaration and quietly drew a flat colour instead of the gradient that was asked for. Splitting on top-level commas only keeps a colour function intact, so the two spellings accept the same set of colours.- Parameters:
body- the text betweenlinear-gradient(and its closing bracket- Returns:
- the stop expressions, which still need their colour parsed
parseStops
Colours from already-split terms, dropping a direction keyword where one is allowed.- Parameters:
terms- the split declaration terms, each a colour or a direction keywordgradient- true for alinear-gradient()stop list, where a leading direction keyword is allowed and has to be skipped- Returns:
- the colours, or null when any term is unusable or nothing remains
installedThemeDir
The directory the console is installed into, taken from the running context.- Returns:
- the theme directory, or null when there is no context (unit tests, shutdown)
variables
The theme's declarations, re-parsed whenever the stylesheet changes.A cached entry is reused while the file's last-modified stamp is unchanged and the entry is younger than
maxCacheAgeMs, so the cost of a warm lookup is one stat() rather than a re-read. The stamp is checked before the cache is consulted for a second reason: a stylesheet that did not exist on an earlier lookup must not be remembered as empty forever, or a theme deployed after startup would never take effect.- Parameters:
themeDir- the directory holding<theme>/console.csstreestheme- the console theme name- Returns:
- the declarations, empty when the stylesheets are absent
stamp
parse
Read a theme's stylesheet and collect its custom properties.- Parameters:
css- the stylesheet to read, null or absent yields an empty map- Returns:
- the declarations, empty when the file is absent or unreadable, which is the normal case in a source checkout where the theme lives under installer/
themeFile
clearCache
static void clearCache()Forget every parsed theme.Not needed in normal operation: both the timestamp and the interval already pick up edits. This exists so a caller that has just rewritten a stylesheet can force a re-read without waiting.