English
English
简体中文
日本語
pdf-icon

Arduino Quick Start

2. Devices & Examples

5. Extensions

6. Applications

M5GFX Library Data Definitions

Color Encoding

M5GFX automatically detects RGB888, RGB565, and RGB332 according to the color data type in use.

Encoding Types

Type Color
uint8_t RGB332
uint16_t RGB565
uint32_t RGB888

Common Color List

Color Hex Value Red (R) Green (G) Blue (B)
TFT_BLACK 0x0000 0 0 0
TFT_NAVY 0x000F 0 0 128
TFT_DARKGREEN 0x03E0 0 128 0
TFT_DARKCYAN 0x03EF 0 128 128
TFT_MAROON 0x7800 128 0 0
TFT_PURPLE 0x780F 128 0 128
TFT_OLIVE 0x7BE0 128 128 0
TFT_LIGHTGREY 0xD69A 211 211 211
TFT_LIGHTGRAY 0xD69A 211 211 211
TFT_DARKGREY 0x7BEF 128 128 128
TFT_DARKGRAY 0x7BEF 128 128 128
TFT_BLUE 0x001F 0 0 255
TFT_GREEN 0x07E0 0 255 0
TFT_CYAN 0x07FF 0 255 255
TFT_RED 0xF800 255 0 0
TFT_MAGENTA 0xF81F 255 0 255
TFT_YELLOW 0xFFE0 255 255 0
TFT_WHITE 0xFFFF 255 255 255
TFT_ORANGE 0xFDA0 255 180 0
TFT_GREENYELLOW 0xB7E0 180 255 0
TFT_PINK 0xFE19 255 192 203
TFT_BROWN 0x9A60 150 75 0
TFT_GOLD 0xFEA0 255 215 0
TFT_SILVER 0xC618 192 192 192
TFT_SKYBLUE 0x867D 135 206 235
TFT_VIOLET 0x915C 180 46 226
TFT_TRANSPARENT 0x0120

Color Depth

Value Bits Number of Colors
1 1 bit 2
2 2 bit 4
4 4 bit 16
8 8 bit 256
16 16 bit 65,536
24 24 bit 16,777,216

enum epd_mode_t

Type Description
epd_quality Fine rendering, slower speed
epd_text
epd_fast
epd_fastest Faster rendering, but lower quality

enum textdatum_t

Reference point for displayed text

Left Aligned Center Aligned Right Aligned
top_left top_center top_right
middle_left middle_center middle_right
bottom_left bottom_center bottom_right
baseline_left baseline_center baseline_right

struct TextStyle

Parameter Type Description
fore_rgb888 uint32_t Font color
back_rgb888 uint32_t Background color
size_x float Text X scale
size_y float Text Y scale
datum textdatum_t Text anchor
padding_x int32_t Padding X
utf8 bool UTF8 encoding
cp437 bool cp437 encoding

struct touch_point_t

Parameter Type Description
x int16_t X coordinate
y int16_t Y coordinate
size uint16_t Point size
id uint8_t Point ID

Differences Between draw/push and write Functions

Unlike draw/push functions, write functions are not wrapped by startWrite and endWrite.
draw/push functions call startWrite and endWrite internally, which makes them slightly slower when executing many drawing operations consecutively. In such cases, execute all draw/push functions between a single startWrite and endWrite to improve speed.

draw/push and write Functions Table

write(read) draw or push (etc)
writePixel drawPixel
writePixels pushPixels
writePixelsDMA pushPixelsDMA
writeFastHLine drawFastHLine
writeFastVLine drawFastVLine
writeFillRect fillRect
writeColor
pushBlock
Note:
pushBlock was not named writeBlock for library version compatibility.

Font List

Latin Fonts

  • EN
cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
&fonts::Font0
&fonts::Font2
&fonts::Font4
&fonts::Font6
&fonts::Font7
&fonts::Font8
&fonts::Font8x8C64
&fonts::AsciiFont8x16
&fonts::AsciiFont24x48
&fonts::TomThumb
&fonts::FreeMono9pt7b
&fonts::FreeMono12pt7b
&fonts::FreeMono18pt7b
&fonts::FreeMono24pt7b
&fonts::FreeMonoBold9pt7b
&fonts::FreeMonoBold12pt7b
&fonts::FreeMonoBold18pt7b
&fonts::FreeMonoBold24pt7b
&fonts::FreeMonoOblique9pt7b
&fonts::FreeMonoOblique12pt7b
&fonts::FreeMonoOblique18pt7b
&fonts::FreeMonoOblique24pt7b
&fonts::FreeMonoBoldOblique9pt7b
&fonts::FreeMonoBoldOblique12pt7b
&fonts::FreeMonoBoldOblique18pt7b
&fonts::FreeMonoBoldOblique24pt7b
&fonts::FreeSans9pt7b
&fonts::FreeSans12pt7b
&fonts::FreeSans18pt7b
&fonts::FreeSans24pt7b
&fonts::FreeSansBold9pt7b
&fonts::FreeSansBold12pt7b
&fonts::FreeSansBold18pt7b
&fonts::FreeSansBold24pt7b
&fonts::FreeSansOblique9pt7b
&fonts::FreeSansOblique12pt7b
&fonts::FreeSansOblique18pt7b
&fonts::FreeSansOblique24pt7b
&fonts::FreeSansBoldOblique9pt7b
&fonts::FreeSansBoldOblique12pt7b
&fonts::FreeSansBoldOblique18pt7b
&fonts::FreeSansBoldOblique24pt7b
&fonts::FreeSerif9pt7b
&fonts::FreeSerif12pt7b
&fonts::FreeSerif18pt7b
&fonts::FreeSerif24pt7b
&fonts::FreeSerifItalic9pt7b
&fonts::FreeSerifItalic12pt7b
&fonts::FreeSerifItalic18pt7b
&fonts::FreeSerifItalic24pt7b
&fonts::FreeSerifBold9pt7b
&fonts::FreeSerifBold12pt7b
&fonts::FreeSerifBold18pt7b
&fonts::FreeSerifBold24pt7b
&fonts::FreeSerifBoldItalic9pt7b
&fonts::FreeSerifBoldItalic12pt7b
&fonts::FreeSerifBoldItalic18pt7b
&fonts::FreeSerifBoldItalic24pt7b
&fonts::Orbitron_Light_24
&fonts::Orbitron_Light_32
&fonts::Roboto_Thin_24
&fonts::Satisfy_24
&fonts::Yellowtail_32
&fonts::DejaVu12
&fonts::DejaVu18
&fonts::DejaVu24
&fonts::DejaVu40
&fonts::DejaVu56
&fonts::DejaVu72
&fonts::DejaVu9

Unicode Fonts

  • JA
cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
&fonts::lgfxJapanMincho_8
&fonts::lgfxJapanMincho_12
&fonts::lgfxJapanMincho_16
&fonts::lgfxJapanMincho_20
&fonts::lgfxJapanMincho_24
&fonts::lgfxJapanMincho_28
&fonts::lgfxJapanMincho_32
&fonts::lgfxJapanMincho_36
&fonts::lgfxJapanMincho_40
&fonts::lgfxJapanMinchoP_8
&fonts::lgfxJapanMinchoP_12
&fonts::lgfxJapanMinchoP_16
&fonts::lgfxJapanMinchoP_20
&fonts::lgfxJapanMinchoP_24
&fonts::lgfxJapanMinchoP_28
&fonts::lgfxJapanMinchoP_32
&fonts::lgfxJapanMinchoP_36
&fonts::lgfxJapanMinchoP_40
&fonts::lgfxJapanGothic_8
&fonts::lgfxJapanGothic_12
&fonts::lgfxJapanGothic_16
&fonts::lgfxJapanGothic_20
&fonts::lgfxJapanGothic_24
&fonts::lgfxJapanGothic_28
&fonts::lgfxJapanGothic_32
&fonts::lgfxJapanGothic_36
&fonts::lgfxJapanGothic_40
&fonts::lgfxJapanGothicP_8
&fonts::lgfxJapanGothicP_12
&fonts::lgfxJapanGothicP_16
&fonts::lgfxJapanGothicP_20
&fonts::lgfxJapanGothicP_24
&fonts::lgfxJapanGothicP_28
&fonts::lgfxJapanGothicP_32
&fonts::lgfxJapanGothicP_36
&fonts::lgfxJapanGothicP_40
&fonts::efontJA_10
&fonts::efontJA_10_b
&fonts::efontJA_10_bi
&fonts::efontJA_10_i
&fonts::efontJA_12
&fonts::efontJA_12_b
&fonts::efontJA_12_bi
&fonts::efontJA_12_i
&fonts::efontJA_14
&fonts::efontJA_14_b
&fonts::efontJA_14_bi
&fonts::efontJA_14_i
&fonts::efontJA_16
&fonts::efontJA_16_b
&fonts::efontJA_16_bi
&fonts::efontJA_16_i
&fonts::efontJA_24
&fonts::efontJA_24_b
&fonts::efontJA_24_bi
&fonts::efontJA_24_i
  • zh-CN
cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
&fonts::efontCN_10
&fonts::efontCN_10_b
&fonts::efontCN_10_bi
&fonts::efontCN_10_i
&fonts::efontCN_12
&fonts::efontCN_12_b
&fonts::efontCN_12_bi
&fonts::efontCN_12_i
&fonts::efontCN_14
&fonts::efontCN_14_b
&fonts::efontCN_14_bi
&fonts::efontCN_14_i
&fonts::efontCN_16
&fonts::efontCN_16_b
&fonts::efontCN_16_bi
&fonts::efontCN_16_i
&fonts::efontCN_24
&fonts::efontCN_24_b
&fonts::efontCN_24_bi
&fonts::efontCN_24_i
  • zh-TW
cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
&fonts::efontTW_10
&fonts::efontTW_10_b
&fonts::efontTW_10_bi
&fonts::efontTW_10_i
&fonts::efontTW_12
&fonts::efontTW_12_b
&fonts::efontTW_12_bi
&fonts::efontTW_12_i
&fonts::efontTW_14
&fonts::efontTW_14_b
&fonts::efontTW_14_bi
&fonts::efontTW_14_i
&fonts::efontTW_16
&fonts::efontTW_16_b
&fonts::efontTW_16_bi
&fonts::efontTW_16_i
&fonts::efontTW_24
&fonts::efontTW_24_b
&fonts::efontTW_24_bi
&fonts::efontTW_24_i
  • KR
cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
&fonts::efontKR_10
&fonts::efontKR_10_b
&fonts::efontKR_10_bi
&fonts::efontKR_10_i
&fonts::efontKR_12
&fonts::efontKR_12_b
&fonts::efontKR_12_bi
&fonts::efontKR_12_i
&fonts::efontKR_14
&fonts::efontKR_14_b
&fonts::efontKR_14_bi
&fonts::efontKR_14_i
&fonts::efontKR_16
&fonts::efontKR_16_b
&fonts::efontKR_16_bi
&fonts::efontKR_16_i
&fonts::efontKR_24
&fonts::efontKR_24_b
&fonts::efontKR_24_bi
&fonts::efontKR_24_i
On This Page