s&
info
About
info
About s&box
newspaper
Latest News
published_with_changes
Changes
map
Roadmap
monitoring
Metrics
games
Games
sports_esports
Browse Games
explore
Discover Games
category
Workshop
sports_esports
Games
landscape
Maps
view_in_ar
Models
texture
Materials
apparel
Clothing
construction
More..
forum
Forum
menu_book
Learn
docs
Documentation
api
Api Reference
school
Tutorials
manage_search
Code Search
input
Log in with Steam
chevron_left
Change Language
简体中文
English
Русский
Español
Português-Brasil
Deutsch
日本語
Français
Polski
Türkçe
한국어
Pirate
Italiano
ไทย
繁體中文
Українська
Čeština
Nederlands
Magyar
Dansk
Suomi
Svenska
Norsk
Ελληνικά
Română
Български
Tiếng Việt
Bahasa Indonesia
Español-Latinoamérica
العربية
Api
Common Structs
Color
chevron_left
Common Structs
struct
Color
Constructors
functions
Color
Fields
crop_din
a
crop_din
b
crop_din
g
crop_din
r
Properties
data_object
Hex
data_object
IsHdr
data_object
IsRepresentableInHex
data_object
IsSdr
data_object
Item
data_object
Luminance
data_object
RawInt
data_object
Rgb
data_object
Rgba
data_object
RgbaInt
data_object
RgbInt
Methods
functions
AdjustHue
functions
ComponentCountChangedBetweenColors
functions
Darken
functions
Desaturate
functions
Invert
functions
LerpTo
functions
Lighten
functions
Saturate
functions
ToColor32
functions
ToHsv
functions
WithAlpha
functions
WithAlphaMultiplied
functions
WithBlue
functions
WithColorMultiplied
functions
WithGreen
functions
WithRed
Static Fields
crop_din
Black
crop_din
Blue
crop_din
Cyan
crop_din
Gray
crop_din
Green
crop_din
Magenta
crop_din
Orange
crop_din
Red
crop_din
Transparent
crop_din
White
crop_din
Yellow
Static Properties
data_object
Random
Static Methods
functions
Average
functions
FromBytes
functions
FromRgb
functions
FromRgba
functions
Lerp
functions
Max
functions
Min
functions
Parse
functions
TryParse
Color
Represents a color using 4 floats (rgba), with 0-1 range.
struct
sealed
Sandbox.System
build
Constructors
1
Color
(
r
,
g
,
b
,
a
)
Initialize a color with each component set to given values, in range [0,1]
crop_din
Fields
4
a
float
The alpha/transparency color component, in range of 0 (fully transparent) to 1 (fully opaque), which
can be exceeded
.
b
float
The blue color component, in range of 0-1, which
can be exceeded
.
g
float
The green color component, in range of 0-1, which
can be exceeded
.
r
float
The red color component, in range of 0-1, which
can be exceeded
.
data_object
Properties
11
Hex
string
String representation of the form "#RRGGBB[AA]".
IsHdr
bool
Returns true if any component exceeds 1
IsRepresentableInHex
bool
Returns true if this color can be represented in hexadecimal format (#RRGGBB[AA]). This may not be the case if the color components are outside of [0,1] range.
IsSdr
bool
Returns true if all components are between 0 and 1
Item
float
Luminance
float
Returns the luminance of the color, basically it's grayscale value or "black and white version".
RawInt
UInt32
Integer representation of the form 0xAABBGGRR as used by native code.
Rgb
string
String representation in the form of
rgb
( r, g, b ) css function notation.
Rgba
string
String representation in the form of
rgba
( r, g, b, a ) css function notation.
RgbaInt
UInt32
Integer representation of the form 0xRRGGBBAA.
RgbInt
UInt32
Integer representation of the form 0xRRGGBB.
functions
Methods
16
AdjustHue
(
amount
)
Color
Increases or decreases this color's hue
ComponentCountChangedBetweenColors
(
b
)
int
Returns how many color components would be changed between this color and another color
Darken
(
fraction
)
Color
Darkens the color by given amount.
Desaturate
(
fraction
)
Color
Desaturates the color by given amount.
Invert
(
)
Color
Returns inverted color. Alpha is unchanged.
LerpTo
(
target
,
frac
,
clamp
)
Color
Performs linear interpolation between this and given colors.
Lighten
(
fraction
)
Color
Lightens the color by given amount.
Saturate
(
fraction
)
Color
Saturates the color by given amount.
ToColor32
(
srgb
)
Color32
Convert to a Color32 (a 32 bit color value)
ToHsv
(
)
ColorHsv
Converts this color to a HSV format.
WithAlpha
(
alpha
)
Color
Returns this color with its alpha value changed
WithAlphaMultiplied
(
alpha
)
Color
Similar to Color.WithAlpha(System.Single) but multiplies the alpha instead of replacing.
WithBlue
(
blue
)
Color
Returns this color with its blue value changed
WithColorMultiplied
(
amount
)
Color
Returns a new version with only the red, green, blue components multiplied
WithGreen
(
green
)
Color
Returns this color with its green value changed
WithRed
(
red
)
Color
Returns this color with its red value changed
crop_din
Static Fields
11
Black
Color
Fully opaque black color.
Blue
Color
Fully opaque pure blue color.
Cyan
Color
Fully opaque cyan color.
Gray
Color
Fully opaque gray color, right between white and black.
Green
Color
Fully opaque pure green color.
Magenta
Color
Fully opaque magenta color.
Orange
Color
Fully opaque orange color.
Red
Color
Fully opaque pure red color.
Transparent
Color
Fully transparent color.
White
Color
Fully opaque white color.
Yellow
Color
Fully opaque yellow color.
data_object
Static Properties
1
Random
Color
Returns a random color out of 8 preset colors.
functions
Static Methods
9
Average
(
values
)
Color
Returns a color whose components are averaged of all given colors.
FromBytes
(
r
,
g
,
b
,
a
)
Color
Creates a color from 0-255 range inputs, converting them to 0-1 range.
FromRgb
(
rgb
)
Color
Converts an integer of the form 0xRRGGBB into the color #RRGGBB with 100% alpha.
FromRgba
(
rgba
)
Color
Converts an integer of the form 0xRRGGBBAA into the color #RRGGBBAA.
Lerp
(
a
,
b
,
frac
,
clamped
)
Color
Performs linear interpolation between two colors.
Max
(
a
,
b
)
Color
Returns a new color with each component being the maximum of the 2 given colors.
Min
(
a
,
b
)
Color
Returns a new color with each component being the minimum of the 2 given colors.
Parse
(
value
)
Nullable`1
Parse the color from a string. Many common formats are supported.
TryParse
(
value
,
color
)
bool
Try to parse the color. Returns true on success
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.