sfml.graphics.Color
See theColor companion object
Utility class for manipulating RGBA colors.
Color is a simple color class composed of 4 components:
- Red
- Green
- Blue
- Alpha (opacity)
Each component is a public member, an unsigned integer in the range [0, 255]. Thus, colors can be constructed and manipulated very easily:
val color = Color(255, 0, 0) // red
val black = color.copy(r = 0) // make it black
val blue = color.copy(b = 128.toByte) // make it dark blue
The fourth component of colors, named "alpha", represents the opacity of the color. A color with an alpha value of 255 will be fully opaque, while an alpha value of 0 will make a color fully transparent, whatever the value of the other components is.
The most common colors are already defined as static variables:
val black = Color.Black()
val white = Color.White()
val red = Color.Red()
val green = Color.Green()
val blue = Color.Blue()
val yellow = Color.Yellow()
val magenta = Color.Magenta()
val cyan = Color.Cyan()
val transparent = Color.Transparent()
Value parameters
- a
-
Alpha (opacity) component.
- b
-
Blue component.
- g
-
Green component.
- r
-
Red component.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
In this article