# Class SurfaceColor

java.lang.Object
com.codename1.surfaces.SurfaceColor

public final class SurfaceColor extends Object

A color used on an external surface. Because surfaces render outside the app (potentially while the app process is dead) they cannot resolve theme constants at render time, so a surface color is either an explicit ARGB value with an optional dark-mode counterpart, or a semantic role the operating system resolves natively (label, secondary label, background, accent).

    SurfaceColor.rgb(0xff333333, 0xffeeeeee)   // dark text in light mode, light text in dark mode
    SurfaceColor.LABEL                         // whatever the OS considers primary label color

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final SurfaceColor`
  `ACCENT`
  The platform accent / tint color.
  `static final SurfaceColor`
  `BACKGROUND`
  The platform's standard surface background color.
  `static final SurfaceColor`
  `LABEL`
  The platform's primary label (body text) color.
  `static final SurfaceColor`
  `SECONDARY_LABEL`
  The platform's secondary (dimmed) label color.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getDark()`
  Returns the dark-mode ARGB value; meaningless for role colors.
  `int`
  `getLight()`
  Returns the light-mode ARGB value; meaningless for role colors.
  `String`
  `getRole()`
  Returns the semantic role name (`label`, `secondaryLabel`, `background`, `accent`), or null for explicit ARGB colors.
  `static SurfaceColor`
  `rgb(int argb)`
  Creates a color used in both light and dark appearance.
  `static SurfaceColor`
  `rgb(int lightArgb, int darkArgb)`
  Creates a color with distinct light and dark appearance values.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### LABEL

    public static final SurfaceColor LABEL
    The platform's primary label (body text) color.

  - ### SECONDARY_LABEL

    public static final SurfaceColor SECONDARY_LABEL
    The platform's secondary (dimmed) label color.

  - ### BACKGROUND

    public static final SurfaceColor BACKGROUND
    The platform's standard surface background color.

  - ### ACCENT

    public static final SurfaceColor ACCENT
    The platform accent / tint color.

- ## Method Details

  - ### rgb

    public static SurfaceColor rgb(int argb)

    Creates a color used in both light and dark appearance. The alpha byte is honored verbatim by every renderer: pass `0xFFRRGGBB` for an opaque color -- a value with a zero alpha byte (e.g. a plain `0xRRGGBB` literal) is fully transparent and draws nothing.

    ###### Parameters

    - `argb`: the color as `0xAARRGGBB`

    ###### Returns

    the color

  - ### rgb

    public static SurfaceColor rgb(int lightArgb, int darkArgb)

    Creates a color with distinct light and dark appearance values. The surface renderer picks the value matching the system appearance. The alpha byte is honored verbatim: pass `0xFFRRGGBB` for opaque colors.

    ###### Parameters

    - `lightArgb`: the color used in light mode as `0xAARRGGBB`
    - `darkArgb`: the color used in dark mode as `0xAARRGGBB`

    ###### Returns

    the color

  - ### getLight

    public int getLight()
    Returns the light-mode ARGB value; meaningless for role colors.

  - ### getDark

    public int getDark()
    Returns the dark-mode ARGB value; meaningless for role colors.

  - ### getRole

    public String getRole()
    Returns the semantic role name (`label`, `secondaryLabel`, `background`, `accent`), or null for explicit ARGB colors.