Skip to content

Color Utilities

Non-Visible component
Category Requires Version
Utilities API 21, Android 5.0 Lollipop 1

Overview

A non-visible component that performs operations like conversion between formats, lightening, and darkening on color data.

Methods

Convert Hex To Int

Returns: Number

Convert a hex color to a integer color. The result is returned as integer.

Params
hex Color Text

Convert Int To Hex

Returns: Text

Convert a integer color to a hex color. The result is returned as string.

Params
color Number

Get Luminance

Returns: Number

Returns the luminance of a color as a float between 0.0 and 1.0. The result is returned as double.

Params
color Number

Is Dark Color

Returns: Boolean

Returns true if the color is dark, else it returns false, means the color is light. The result is returned as boolean.

Params
color Number

Set Alpha Value

Returns: Number

Set a alpha value to a color. The result is returned as integer.

Params
color Number
alpha Number

Last update: November 9, 2022