Color

smile.colors.Color
See theColor companion class
object Color

Utility methods for creating and converting colors in various color spaces and formats, including HSI (Hue, Saturation, Intensity) and RGBA (Red, Green, Blue, Alpha), and for lightening or darkening colors.

Attributes

See also
Companion
class
Source
Color.scala
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Color.type

Members list

Type members

Inherited and Abstract types

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
Source
Mirror.scala

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror
Source
Mirror.scala

Value members

Concrete methods

def argbIntFrom(red: Int, green: Int, blue: Int, opacity: Int = ...): Int

Creates an ARGB integer value from RGBA components. Validates the RGBA components before conversion.

Creates an ARGB integer value from RGBA components. Validates the RGBA components before conversion.

Value parameters

blue

The blue component, in the range [0, 255].

green

The green component, in the range [0, 255].

opacity

The opacity component, in the range [0, 255]. Default is 255.

red

The red component, in the range [0, 255].

Attributes

Source
Color.scala
def fromHSI(hue: Double, saturation: Double, intensity: Double, opacity: Int = ...): Color

Creates a Color instance from HSI values with optional opacity. Validates the input values for HSI and opacity before conversion.

Creates a Color instance from HSI values with optional opacity. Validates the input values for HSI and opacity before conversion.

Value parameters

hue

The hue component of the color, in degrees [0, 360).

intensity

The intensity component of the color, in the range [0, 255].

opacity

The opacity of the color, in the range [0, 255]. Default is 255.

saturation

The saturation component of the color, in the range [0, 1].

Attributes

Source
Color.scala
def fromRgbaInt(rgba: Int): Color

Attributes

Source
Color.scala
def hsiToRGB(hueInDegrees: Double, saturation: Double, intensity: Double): (Int, Int, Int)

Converts HSI values to RGB. Validates the input HSI values before conversion.

Converts HSI values to RGB. Validates the input HSI values before conversion.

Value parameters

hueInDegrees

The hue component of the color, in degrees [0, 360).

intensity

The intensity component of the color, in the range [0, 255].

saturation

The saturation component of the color, in the range [0, 1].

Attributes

Source
Color.scala
def isBlack(red: Int, green: Int, blue: Int): Boolean

Determines if the specified RGB color is black. A color is considered black if its red, green, and blue components are all at their minimum value, 0.

Determines if the specified RGB color is black. A color is considered black if its red, green, and blue components are all at their minimum value, 0.

Attributes

Source
Color.scala
def isGray(red: Int, green: Int, blue: Int): Boolean

Determines if the specified RGB color is a shade of gray. A color is considered gray if its red, green, and blue components are equal.

Determines if the specified RGB color is a shade of gray. A color is considered gray if its red, green, and blue components are equal.

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].

red

The red component of the color, in the range [0, 255].

Attributes

Source
Color.scala
def rgbToHSI(red: Int, green: Int, blue: Int): (Double, Double, Double)

Converts RGB values to HSI (Hue, Saturation, Intensity). Validates the input RGB values before conversion.

Converts RGB values to HSI (Hue, Saturation, Intensity). Validates the input RGB values before conversion.

Value parameters

blue

The blue component, in the range [0, 255].

green

The green component, in the range [0, 255].

red

The red component, in the range [0, 255].

Attributes

Returns

A tuple containing the HSI components: (hue, saturation, intensity). A gray has no hue of its own, so its hue is reported as smile.colors.Color.GrayHSIHue and its saturation as zero. smile.colors.Color.fromHSI and smile.colors.Color.hsiToRGB accept every returned triple and ignore the hue when saturation is zero.

Source
Color.scala
def rgbaIntFrom(red: Int, green: Int, blue: Int, opacity: Int = ...): Int

Attributes

Source
Color.scala

Concrete fields

The hue smile.colors.Color.rgbToHSI reports for a gray, which has no hue of its own. It is zero, the start of the color circle. smile.colors.Color.fromHSI and smile.colors.Color.hsiToRGB reject a NaN hue.

The hue smile.colors.Color.rgbToHSI reports for a gray, which has no hue of its own. It is zero, the start of the color circle. smile.colors.Color.fromHSI and smile.colors.Color.hsiToRGB reject a NaN hue.

Attributes

Source
Color.scala

Givens

Givens

Attributes

Source
Color.scala