case class RGBColor(red: Int, green: Int, blue: Int, alpha: Int = 255) extends DigitalColor[RGBChannel, Int, RGBColor] with Product with Serializable
Represents an RGB color with red, green, and blue components.
- red
the intensity of the red channel (0–255)
- green
the intensity of the green channel (0–255)
- blue
the intensity of the blue channel (0–255)
- Alphabetic
- By Inheritance
- RGBColor
- Serializable
- Product
- Equals
- DigitalColor
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new RGBColor(red: Int, green: Int, blue: Int, alpha: Int = 255)
- red
the intensity of the red channel (0–255)
- green
the intensity of the green channel (0–255)
- blue
the intensity of the blue channel (0–255)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val alpha: Int
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val blue: Int
- def clamp(value: Int): Int
Clamps a color channel value to the valid range [0, 255].
Clamps a color channel value to the valid range [0, 255]. Values below 0 are set to 0, and values above 255 are set to 255.
- Attributes
- protected
- Definition Classes
- RGBColor → DigitalColor
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- def color: Color
Converts this RGBColor instance into a java.awt.Color object.
Converts this RGBColor instance into a java.awt.Color object.
- returns
a Color object representing this RGB color
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- val green: Int
- def increaseAll(deltaR: Int, deltaG: Int, deltaB: Int, deltaA: Int = 0): RGBColor
Increases or decreases all color channels simultaneously by different
Increases or decreases all color channels simultaneously by different
amounts. Each channel is clamped to stay within [0, 255].
- deltaR
the amount to add to the red channel
- deltaG
the amount to add to the green channel
- deltaB
the amount to add to the blue channel
- returns
a new RGBColor with adjusted channels
- def increaseChannel(channel: RGBChannel, delta: Int)(implicit numeric: Numeric[Int]): RGBColor
Increase a channel by an amount
Increase a channel by an amount
- Definition Classes
- DigitalColor
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def mixWith(other: RGBColor, ratio: Double): RGBColor
Blends this color with another color based on the given ratio.
Blends this color with another color based on the given ratio. A ratio of 0.0 returns this color; a ratio of 1.0 returns the other color.
- other
the other color to mix with
- ratio
the blend ratio between 0.0 and 1.0
- returns
a new RGBColor representing the blended color
- Exceptions thrown
IllegalArgumentExceptionif the ratio is outside [0.0, 1.0]
- def modifyChannel(channel: RGBChannel)(f: (Int) => Int): RGBColor
Increases or decreases a specific color channel (Red, Green, or Blue) by the given amount, ensuring the resulting value stays within [0, 255].
Increases or decreases a specific color channel (Red, Green, or Blue) by the given amount, ensuring the resulting value stays within [0, 255].
- channel
the color channel to modify
- f
transformation function for the amount to add (can be negative)
- returns
a new RGBColor with the modified channel
- Definition Classes
- RGBColor → DigitalColor
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- val red: Int
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toHex: String
Returns the hexadecimal string representation of this color, typically used in web development (e.g., "#ff00cc").
Returns the hexadecimal string representation of this color, typically used in web development (e.g., "#ff00cc").
- returns
a lowercase hexadecimal color string
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)