color property

Object get color

An array of four integers in the range 0,255 that make up the RGBA color of the badge. For example, opaque red is [255, 0, 0, 255]. Can also be a string with a CSS value, with opaque red being #FF0000 or #F00. Not setting this value will cause a color to be automatically chosen that will contrast with the badge's background color so the text will be visible. Colors with alpha values equivalent to 0 will not be set and will return an error.

Implementation

Object get color => _wrapped.color.when(
      isString: (v) => v,
      isOther: (v) => (v as $js_browser_action.ColorArray)
          .toDart
          .cast<int>()
          .map((e) => e)
          .toList(),
    );
set color (Object v)

Implementation

set color(Object v) {
  _wrapped.color = switch (v) {
    String() => v.jsify()!,
    List<int>() => v.toJSArray((e) => e),
    _ => throw UnsupportedError(
        'Received type: ${v.runtimeType}. Supported types are: String, List<int>')
  };
}