Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class Colors

  1. Object
  2. Colors
Parses and formats CSS colors.

Methods

public static int parse(String s, int def)Parses #rgb, #rgba, #rrggbb, #rrggbbaa, rgb(), rgba(), hsl(), hsla(), a named color or transparent.
public static String toHex(int argb)Formats a color as #rrggbb, ignoring alpha.

Inherited methods

Method details

parse

public static int parse(String s, int def)
Parses #rgb, #rgba, #rrggbb, #rrggbbaa, rgb(), rgba(), hsl(), hsla(), a named color or transparent.

Parameters

s String
the color text
def int
returned when s is null or not a color

Returns

the color as 0xAARRGGBB

toHex

public static String toHex(int argb)
Formats a color as #rrggbb, ignoring alpha.

Parameters

argb int
the color