lv_color.h

Defines

_LV_COLOR_NATIVE_WITH_ALPHA_SIZE
LV_OPA_MIN
LV_OPA_MAX
LV_COLOR_FORMAT_IS_INDEXED(cf)
LV_COLOR_INDEXED_PALETTE_SIZE(cf)
LV_COLOR_MAKE(r8, g8, b8)
LV_OPA_MIX2(a1, a2)
LV_OPA_MIX3(a1, a2, a3)

Typedefs

typedef _lv_opa_t lv_opa_t
typedef _lv_color_format_t lv_color_format_t

Enums

enum _lv_opa_t

Opacity percentages.

Values:

enumerator LV_OPA_TRANSP
enumerator LV_OPA_0
enumerator LV_OPA_10
enumerator LV_OPA_20
enumerator LV_OPA_30
enumerator LV_OPA_40
enumerator LV_OPA_50
enumerator LV_OPA_60
enumerator LV_OPA_70
enumerator LV_OPA_80
enumerator LV_OPA_90
enumerator LV_OPA_100
enumerator LV_OPA_COVER
enum _lv_color_format_t

Values:

enumerator LV_COLOR_FORMAT_UNKNOWN
enumerator LV_COLOR_FORMAT_RAW
enumerator LV_COLOR_FORMAT_RAW_ALPHA
enumerator LV_COLOR_FORMAT_L8
enumerator LV_COLOR_FORMAT_I1
enumerator LV_COLOR_FORMAT_I2
enumerator LV_COLOR_FORMAT_I4
enumerator LV_COLOR_FORMAT_I8
enumerator LV_COLOR_FORMAT_A8
enumerator LV_COLOR_FORMAT_RGB565
enumerator LV_COLOR_FORMAT_RGB565A8

Color array followed by Alpha array

enumerator LV_COLOR_FORMAT_RGB888
enumerator LV_COLOR_FORMAT_ARGB8888
enumerator LV_COLOR_FORMAT_XRGB8888
enumerator LV_COLOR_FORMAT_NATIVE_REVERSED
enumerator LV_COLOR_FORMAT_A1
enumerator LV_COLOR_FORMAT_A2
enumerator LV_COLOR_FORMAT_A4
enumerator LV_COLOR_FORMAT_NATIVE
enumerator LV_COLOR_FORMAT_NATIVE_WITH_ALPHA

Functions

uint8_t lv_color_format_get_bpp(lv_color_format_t cf)

Get the pixel size of a color format in bits, bpp

Parameters:

src_cf -- a color format (LV_COLOR_FORMAT_...)

Returns:

the pixel size in bits

static inline uint8_t lv_color_format_get_size(lv_color_format_t cf)

Get the pixel size of a color format in bytes

Parameters:

src_cf -- a color format (LV_COLOR_FORMAT_...)

Returns:

the pixel size in bytes

bool lv_color_format_has_alpha(lv_color_format_t src_cf)

Check if a color format has alpha channel or not

Parameters:

src_cf -- a color format (LV_IMAGE_CF_...)

Returns:

true: has alpha channel; false: doesn't have alpha channel

lv_color32_t lv_color_to_32(lv_color_t color, lv_opa_t opa)
static inline uint32_t lv_color_to_int(lv_color_t c)
static inline lv_color_t lv_color_from_int(uint32_t v)
static inline bool lv_color_eq(lv_color_t c1, lv_color_t c2)
static inline bool lv_color32_eq(lv_color32_t c1, lv_color32_t c2)
static lv_color_t lv_color_hex(uint32_t c)
static inline lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b)
static inline lv_color_t lv_color_hex3(uint32_t c)
uint16_t lv_color_to_u16(lv_color_t color)
uint32_t lv_color_to_u32(lv_color_t color)
static inline uint16_t lv_color_16_16_mix(uint16_t c1, uint16_t c2, uint8_t mix)
lv_color_t lv_color_lighten(lv_color_t c, lv_opa_t lvl)
lv_color_t lv_color_darken(lv_color_t c, lv_opa_t lvl)
lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v)

Convert a HSV color to RGB

Parameters:
  • h -- hue [0..359]

  • s -- saturation [0..100]

  • v -- value [0..100]

Returns:

the given RGB color in RGB (with LV_COLOR_DEPTH depth)

lv_color_hsv_t lv_color_rgb_to_hsv(uint8_t r8, uint8_t g8, uint8_t b8)

Convert a 32-bit RGB color to HSV

Parameters:
  • r8 -- 8-bit red

  • g8 -- 8-bit green

  • b8 -- 8-bit blue

Returns:

the given RGB color in HSV

lv_color_hsv_t lv_color_to_hsv(lv_color_t color)

Convert a color to HSV

Parameters:

color -- color

Returns:

the given color in HSV

static inline lv_color_t lv_color_white(void)
static inline lv_color_t lv_color_black(void)

Variables

const lv_color_filter_dsc_t lv_color_filter_shade
struct lv_color_t

Public Members

uint8_t blue
uint8_t green
uint8_t red
struct lv_color16_t

Public Members

uint16_t blue
uint16_t green
uint16_t red
struct lv_color32_t

Public Members

uint8_t blue
uint8_t green
uint8_t red
uint8_t alpha
struct lv_color_hsv_t

Public Members

uint16_t h
uint8_t s
uint8_t v