#pragma once
#include <stdint.h>

typedef struct {
  uint8_t r;
  uint8_t g;
  uint8_t b;
} Color;

typedef struct {
  char *utf8;
  const Color *fg;
  const Color *bg;
  uint8_t flags : 3;
} ScreenCell;

extern int rows;
extern int cols;
extern ScreenCell *screen;
extern const Color colors[];

int display_width(const char *grapheme);
void insert_screen(int row, int col, char *utf8, const Color *fg,
                   const Color *bg, uint8_t flags);
void start_screen();
void end_screen();
void put_screen();
void disable_raw_mode();
