Represents a color with RGB and opacity components. The predefined colors in smile.colors.PresetColor are plain values of this class.
Value parameters
- blue
-
The blue component of the color, in the range [0, 255].
- green
-
The green component of the color, in the range [0, 255].
- opacity
-
The opacity of the color, in the range [0, 255]. Defaults to 255.
- red
-
The red component of the color, in the range [0, 255].
Attributes
- Companion
- object
- Source
- Color.scala
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Paintclass Objecttrait Matchableclass AnyShow all
Members list
Value members
Constructors
Attributes
- Source
- Color.scala
Concrete methods
Darkens the color by a default factor.
Checks if the color is fully opaque, with an opacity of 255.
Lightens the color by a default factor.
Darkens the color by a specified factor.
Darkens the color by a specified factor.
Value parameters
- shadingFactorFromZeroToOne
-
The factor to darken the color by, in the range [0, 1].
Attributes
- Source
- Color.scala
Darkens the color by a specified percentage.
Darkens the color by a specified percentage.
Value parameters
- shadingFactorInPercents
-
The percentage to darken the color by, in the range [0, 100].
Attributes
- Source
- Color.scala
Lightens the color by a specified factor.
Lightens the color by a specified factor.
Value parameters
- tintingFactorFromZeroToOne
-
The factor to lighten the color by, in the range [0, 1].
Attributes
- Source
- Color.scala
Lightens the color by a specified percentage.
Lightens the color by a specified percentage.
import smile.colors.PresetColor.*
import smile.pictures.*
val tints = (0 to 80 by 20).map(percent => Blue.tintByPercentage(percent))
val squares = tints.map(tint => Rectangle(30, fillWith(tint), None))
val ramp = squares.reduce[Element]((row, next) => row.addToRight(next))

Value parameters
- tintingFactorInPercents
-
The percentage to lighten the color by, in the range [0, 100].
Attributes
- Source
- Color.scala
Converts the color to an ARGB integer.
Converts the color to HSI (Hue, Saturation, Intensity) format.
Converts the color to an RGBA integer.
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
- Returns
-
a string representation of the object.
- Definition Classes
-
Any
- Source
- Color.scala
Inherited methods
An iterator over the names of all the elements of this product.
An iterator over the names of all the elements of this product.
Attributes
- Inherited from:
- Product
- Source
- Product.scala
An iterator over all the elements of this product.
An iterator over all the elements of this product.
Attributes
- Returns
-
in the default implementation, an
Iterator[Any] - Inherited from:
- Product
- Source
- Product.scala
Concrete fields
The color this paint amounts to over its whole pattern. A renderer that cannot paint the pattern paints this color.
The color this paint amounts to over its whole pattern. A renderer that cannot paint the pattern paints this color.
Attributes
- Source
- Color.scala
