Record Class BasicChartTheme

java.lang.Object
java.lang.Record
com.arbergashi.charts.api.BasicChartTheme
All Implemented Interfaces:
ChartTheme

public record BasicChartTheme(Color background, Color foreground, Color gridColor, Color axisLabelColor, Color accentColor, Color[] seriesColors, Font baseFont) extends Record implements ChartTheme
Basic implementation of ChartTheme using immutable value object pattern.
Since:
2026-01-16
Version:
1.0.0
Author:
Arber Gashi
  • Constructor Details

    • BasicChartTheme

      public BasicChartTheme(Color background, Color foreground, Color gridColor, Color axisLabelColor, Color accentColor, Color[] seriesColors, Font baseFont)
      Creates an instance of a BasicChartTheme record class.
      Parameters:
      background - the value for the background record component
      foreground - the value for the foreground record component
      gridColor - the value for the gridColor record component
      axisLabelColor - the value for the axisLabelColor record component
      accentColor - the value for the accentColor record component
      seriesColors - the value for the seriesColors record component
      baseFont - the value for the baseFont record component
  • Method Details

    • getBackground

      public Color getBackground()
      Description copied from interface: ChartTheme
      Gets the background color for the chart panel.
      Specified by:
      getBackground in interface ChartTheme
      Returns:
      The background color
    • getForeground

      public Color getForeground()
      Description copied from interface: ChartTheme
      Gets the foreground color for text and lines.
      Specified by:
      getForeground in interface ChartTheme
      Returns:
      The foreground color
    • getGridColor

      public Color getGridColor()
      Description copied from interface: ChartTheme
      Gets the grid color for axes and grid lines.
      Specified by:
      getGridColor in interface ChartTheme
      Returns:
      The grid color
    • getAxisLabelColor

      public Color getAxisLabelColor()
      Description copied from interface: ChartTheme
      Gets the color for axis labels.
      Specified by:
      getAxisLabelColor in interface ChartTheme
      Returns:
      The axis label color
    • getAccentColor

      public Color getAccentColor()
      Description copied from interface: ChartTheme
      Gets the accent color (primary highlight color).
      Specified by:
      getAccentColor in interface ChartTheme
      Returns:
      The accent color
    • getSeriesColor

      public Color getSeriesColor(int index)
      Description copied from interface: ChartTheme
      Gets a series color by index.

      Implementations should cycle through available colors using modulo arithmetic to ensure a valid color is always returned.

      Specified by:
      getSeriesColor in interface ChartTheme
      Parameters:
      index - The series index (0-based)
      Returns:
      The series color for the given index
    • getBaseFont

      public Font getBaseFont()
      Description copied from interface: ChartTheme
      Gets the base font for chart text.
      Specified by:
      getBaseFont in interface ChartTheme
      Returns:
      The base font
    • builder

      public static BasicChartTheme.Builder builder()
      Creates a new builder for constructing a BasicChartTheme.
      Returns:
      A new Builder instance
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • background

      public Color background()
      Returns the value of the background record component.
      Returns:
      the value of the background record component
    • foreground

      public Color foreground()
      Returns the value of the foreground record component.
      Returns:
      the value of the foreground record component
    • gridColor

      public Color gridColor()
      Returns the value of the gridColor record component.
      Returns:
      the value of the gridColor record component
    • axisLabelColor

      public Color axisLabelColor()
      Returns the value of the axisLabelColor record component.
      Returns:
      the value of the axisLabelColor record component
    • accentColor

      public Color accentColor()
      Returns the value of the accentColor record component.
      Returns:
      the value of the accentColor record component
    • seriesColors

      public Color[] seriesColors()
      Returns the value of the seriesColors record component.
      Returns:
      the value of the seriesColors record component
    • baseFont

      public Font baseFont()
      Returns the value of the baseFont record component.
      Returns:
      the value of the baseFont record component