First thing to note is that color is 16-bit, and that includes Red, Green and Blue in a 16-bit variable. The way the color is packed in is the top 5 bits are red, the middle 6 bits are green and the bottom 5 bits are blue.
For solid colors, we have this handy cheat-sheet. Of course, you can pick any of 262,000 colors but while starting out, this might be helpful.
// Color definitions #define BLACK 0x0000 #define BLUE 0x001F #define RED 0xF800 #define GREEN 0x07E0 #define CYAN 0x07FF #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF
Here is a basic introduction to the GFX lib, it doesn't cover everything but it shows you what some of the most popular shapes look like
First up is the most basic pixel pusher. You can call this with two coordinates and a color and it will make a dot:
void drawPixel(uint16_t x, uint16_t y, uint16_t color);
void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);
void drawVerticalLine(uint16_t x0, uint16_t y0, uint16_t length, uint16_t color); void drawHorizontalLine(uint16_t x0, uint16_t y0, uint16_t length, uint16_t color);
void drawRect(uint16_t x0, uint16_t y0, uint16_t w, uint16_t h, uint16_t color); void fillRect(uint16_t x0, uint16_t y0, uint16_t w, uint16_t h, uint16_t color);
void drawCircle(uint16_t x0, uint16_t y0, uint16_t r, uint16_t color); void fillCircle(uint16_t x0, uint16_t y0, uint16_t r, uint16_t color);
void setCursor(uint16_t x0, uint16_t y0); void setTextColor(uint16_t color); void setTextSize(uint8_t size);
Finally, you can use print() or println() just like you do with Serial! For example, to print a string, use print("Hello world") - that's the first line of the image above. To print variables, you can also use print() the second line isprint(1234.56) and the third line is print(0xDEADBEEF, HEX).
You can also rotate your drawing. Note that this will not rotate what you already drew, but it will relocate any new drawing.
void rotate(uint8_t rotation);
When you rotate, the origin point moves with you. You may need to reference the size of the screen, which changes between portrait and landscape, use width() and height()! To get the size.
uint16_t width(); uint16_t height();