Brush class

A Brush holds color information and describes how to draw the inside of a Shape or the stroke of a shape or a TextBlock or the background of any GraphObject.

A Brush must not be modified once it has been assigned to a GraphObject, such as the Shape#fill or TextBlock#stroke or GraphObject#background. However, a Brush may be shared by multiple GraphObjects.

Available Extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

Brush([Object? type, dynamic init])
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

hsl EnumValue
For lightening and darkening, used as a color-space value.
getter/setter pair
lab EnumValue
For lightening and darkening, used as a color-space value.
getter/setter pair
linear EnumValue
For linear gradient brushes, used as the value for Brush#type.
getter/setter pair
pattern EnumValue
For pattern brushes, used as the value for Brush#type.
getter/setter pair
radial EnumValue
For radial gradient brushes, used as the value for Brush#type.
getter/setter pair
solid EnumValue
For simple, solid color brushes, used as the value for Brush#type.
getter/setter pair

Static Methods

darken(String color) String
This static function takes a color and darkens it by 20% in the Lab color space. This is a convenience function which calls Brush.darkenBy.
darkenBy(String color, [num? fraction, EnumValue? mode]) String
This static function takes a color and darkens it.
isDark(dynamic color) bool
This static function takes a color and determines whether it is "dark." Does not account for transparency.
isValidColor(String color) bool
This static function returns true if a given color string is well-formed for drawing.
lighten(String color) String
This static function takes a color and lightens it by 20% in the Lab color space. This is a convenience function which calls Brush.lightenBy.
lightenBy(String color, [num? fraction, EnumValue? mode]) String
This static function takes a color and lightens it.
mix(String color1, String color2, [num? fraction]) String
This static function takes two colors and mixes them together, using the (optionally) specified amount of the second color.
randomColor([num? min, num? max]) String
This static function can be used to generate a random color.