# SurfaceColors

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/elevation/SurfaceColors.java)

*** ** * ** ***


```
public enum SurfaceColors
```

<br />

*** ** * ** ***

Provides a convenient way to get color values of tonal variations of `R.attr.colorSurface`.

## Summary

| ### Enum Values |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/elevation/SurfaceColors#SURFACE_0` |   |
| `https://developer.android.com/reference/com/google/android/material/elevation/SurfaceColors#SURFACE_1` |   |
| `https://developer.android.com/reference/com/google/android/material/elevation/SurfaceColors#SURFACE_2` |   |
| `https://developer.android.com/reference/com/google/android/material/elevation/SurfaceColors#SURFACE_3` |   |
| `https://developer.android.com/reference/com/google/android/material/elevation/SurfaceColors#SURFACE_4` |   |
| `https://developer.android.com/reference/com/google/android/material/elevation/SurfaceColors#SURFACE_5` |   |

| ### Public methods |
|---|---|
| `int` | `https://developer.android.com/reference/com/google/android/material/elevation/SurfaceColors#getColor(Context)(Context context)` Returns the tonal surface color value in RGB. |
| `static int` | `https://developer.android.com/reference/com/google/android/material/elevation/SurfaceColors#getColorForElevation(Context,float)(Context context, float elevation)` Returns the corresponding surface color in RGB with the given elevation. |
| `static https://developer.android.com/reference/com/google/android/material/elevation/SurfaceColors` | `https://developer.android.com/reference/com/google/android/material/elevation/SurfaceColors#valueOf(java.lang.String)(https://developer.android.com/reference/java/lang/String name)` Returns the enum constant of this type with the specified name. |
| `static SurfaceColors[]` | `https://developer.android.com/reference/com/google/android/material/elevation/SurfaceColors#values()()` Returns an array containing the constants of this enum type, in the order they're declared. |

## Enum Values

### SURFACE_0

```
SurfaceColors SurfaceColors.SURFACE_0
```

### SURFACE_1

```
SurfaceColors SurfaceColors.SURFACE_1
```

### SURFACE_2

```
SurfaceColors SurfaceColors.SURFACE_2
```

### SURFACE_3

```
SurfaceColors SurfaceColors.SURFACE_3
```

### SURFACE_4

```
SurfaceColors SurfaceColors.SURFACE_4
```

### SURFACE_5

```
SurfaceColors SurfaceColors.SURFACE_5
```

## Public methods

### getColor

```
public int getColor(Context context)
```

Returns the tonal surface color value in RGB.

### getColorForElevation

```
public static int getColorForElevation(Context context, float elevation)
```

Returns the corresponding surface color in RGB with the given elevation.

### valueOf

```
public static SurfaceColors valueOf(String name)
```

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/elevation/SurfaceColors` | the enum constant with the specified name |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if this enum type has no constant with the specified name |

### values

```
public static SurfaceColors[] values()
```

Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants.

| Returns |
|---|---|
| `SurfaceColors[]` | an array containing the constants of this enum type, in the order they're declared |