Record Class Palette

java.lang.Object
java.lang.Record
com.onec.ui.divkit.Palette

public record Palette(String page, String surface, String border, String text, String muted, String faint, String primary, String primarySoft, String success, String successSoft, String rowAlt) extends Record
Theme-aware color palette mirroring the app's shadcn CSS variables (a neutral, zero-saturation scale) so emitted DivKit surfaces match the rest of the UI in light and dark. The client passes ?theme=dark|light; the controller resolves it via of(java.lang.String) and threads the palette through the builders.

A consumer can override any slot from Java via shell().light(...) / shell().dark(...) — those land here as a BrandPalette merged over the built-in LIGHT/DARK constants by of(String, BrandingConfig).

  • Field Details

    • LIGHT

      public static final Palette LIGHT
    • DARK

      public static final Palette DARK
  • Constructor Details

    • Palette

      public Palette(String page, String surface, String border, String text, String muted, String faint, String primary, String primarySoft, String success, String successSoft, String rowAlt)
      Creates an instance of a Palette record class.
      Parameters:
      page - the value for the page record component
      surface - the value for the surface record component
      border - the value for the border record component
      text - the value for the text record component
      muted - the value for the muted record component
      faint - the value for the faint record component
      primary - the value for the primary record component
      primarySoft - the value for the primarySoft record component
      success - the value for the success record component
      successSoft - the value for the successSoft record component
      rowAlt - the value for the rowAlt record component
  • Method Details

    • of

      public static Palette of(String theme)
    • of

      public static Palette of(String theme, BrandingConfig branding)
      The palette for theme with the consumer's BrandingConfig overrides merged in. Starts from the built-in LIGHT/DARK and replaces only the slots the app set, so unbranded apps render exactly as before.
    • withOverrides

      public Palette withOverrides(BrandPalette o)
      This palette with any non-null slot of o replacing the default; a no-op if empty.
    • 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.
    • page

      public String page()
      Returns the value of the page record component.
      Returns:
      the value of the page record component
    • surface

      public String surface()
      Returns the value of the surface record component.
      Returns:
      the value of the surface record component
    • border

      public String border()
      Returns the value of the border record component.
      Returns:
      the value of the border record component
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • muted

      public String muted()
      Returns the value of the muted record component.
      Returns:
      the value of the muted record component
    • faint

      public String faint()
      Returns the value of the faint record component.
      Returns:
      the value of the faint record component
    • primary

      public String primary()
      Returns the value of the primary record component.
      Returns:
      the value of the primary record component
    • primarySoft

      public String primarySoft()
      Returns the value of the primarySoft record component.
      Returns:
      the value of the primarySoft record component
    • success

      public String success()
      Returns the value of the success record component.
      Returns:
      the value of the success record component
    • successSoft

      public String successSoft()
      Returns the value of the successSoft record component.
      Returns:
      the value of the successSoft record component
    • rowAlt

      public String rowAlt()
      Returns the value of the rowAlt record component.
      Returns:
      the value of the rowAlt record component